Skip to contentSkip to conversation

ara virt interface of perf to support kvm guest os statistics collection in guest os

PATCH In review Zhang, Yanmin 2 participants 3 messages Jun 21, 2010 – Jun 22, 2010 KVM

lore
Share & tools
lore
#0 lore raw

PATCH v2 5/5 ara virt interface of perf to support kvm guest os statistics collection in guest os

The 5th patch is applied to the latest qemu-kvm tree.

---

kvm/include/linux/kvm.h +1 -0
diff -Nraup qemu-kvm_0621/kvm/include/linux/kvm.h qemu-kvm_0621_perf/kvm/include/linux/kvm.h
@@ -530,6 +530,7 @@ struct kvm_enable_cap {
 #ifdef __KVM_HAVE_XCRS
 #define KVM_CAP_XCRS 56
 #endif
+#define KVM_CAP_PV_PERF 57
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
kvm/include/x86/asm/kvm_para.h +1 -0
diff -Nraup qemu-kvm_0621/kvm/include/x86/asm/kvm_para.h qemu-kvm_0621_perf/kvm/include/x86/asm/kvm_para.h
@@ -15,6 +15,7 @@
 #define KVM_FEATURE_CLOCKSOURCE		0
 #define KVM_FEATURE_NOP_IO_DELAY	1
 #define KVM_FEATURE_MMU_OP		2
+#define KVM_FEATURE_PV_PERF		4
 
 #define MSR_KVM_WALL_CLOCK  0x11
 #define MSR_KVM_SYSTEM_TIME 0x12
target-i386/kvm.c +3 -0
diff -Nraup qemu-kvm_0621/target-i386/kvm.c qemu-kvm_0621_perf/target-i386/kvm.c
@@ -150,6 +150,9 @@ struct kvm_para_features {
 #ifdef KVM_CAP_PV_MMU
         { KVM_CAP_PV_MMU, KVM_FEATURE_MMU_OP },
 #endif
+#ifdef KVM_CAP_PV_PERF
+        { KVM_CAP_PV_PERF, KVM_FEATURE_PV_PERF },
+#endif
         { -1, -1 }
 };
 
#1 lore raw
Quoted 6 lines · Yanmin

The 5th patch is applied to the latest qemu-kvm tree.

target-i386/kvm.c struct kvm_para_features { · line 158

Quoted 9 lines
target-i386/kvm.c +3 -0
@@ -150,6 +150,9 @@ struct kvm_para_features {
  #ifdef KVM_CAP_PV_MMU
          { KVM_CAP_PV_MMU, KVM_FEATURE_MMU_OP },
  #endif
+#ifdef KVM_CAP_PV_PERF
+        { KVM_CAP_PV_PERF, KVM_FEATURE_PV_PERF },
+#endif
          { -1, -1 }
  };
 

Not really necessary any more - if you expose the cpuid bit via KVM_GET_SUPPORTED_CPUID2 then 'qemu -cpu host' will automatically enable it.

On the other hand, do update target-i386/cpuid.c:kvm_feature_name so people can enable the feature using qemu -cpu ...,+kvmperf.

Signature · 1 line
error compiling committee.c: too many arguments to function
#2 lore raw
Quoted 21 lines · Avi Kivity
Quoted 6 lines · Yanmin

The 5th patch is applied to the latest qemu-kvm tree.

target-i386/kvm.c struct kvm_para_features { · line 158

Quoted 9 lines
target-i386/kvm.c +3 -0
@@ -150,6 +150,9 @@ struct kvm_para_features {
  #ifdef KVM_CAP_PV_MMU
          { KVM_CAP_PV_MMU, KVM_FEATURE_MMU_OP },
  #endif
+#ifdef KVM_CAP_PV_PERF
+        { KVM_CAP_PV_PERF, KVM_FEATURE_PV_PERF },
+#endif
          { -1, -1 }
  };
 

Not really necessary any more - if you expose the cpuid bit via KVM_GET_SUPPORTED_CPUID2 then 'qemu -cpu host' will automatically enable it.

Quoted 2 lines

On the other hand, do update target-i386/cpuid.c:kvm_feature_name so people can enable the feature using qemu -cpu ...,+kvmperf.

Thanks for the good pointer. I will change it.

Avi,

Thanks for your wonderful comments. I will fix all in the patches. As for the live migration, I need check it carefully. If you could provide some suggestions on it, especially about how/when to save all perf_events and restore all pref_events, that would be very helpful.

Yanmin