Skip to contentSkip to conversation

perf & kvm: Enhance perf to collect KVM guest os statistics from host side

PATCH In review Zhang, Yanmin 1 participant 1 message Apr 19, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v5 2/3 perf & kvm: Enhance perf to collect KVM guest os statistics from host side

Below patch implements the perf_guest_info_callbacks on kvm.

---

arch/x86/kvm/vmx.c +4 -1
diff -Nraup linux-2.6_tip0417/arch/x86/kvm/vmx.c linux-2.6_tip0417_perfkvm/arch/x86/kvm/vmx.c
@@ -3654,8 +3654,11 @@ static void vmx_complete_interrupts(stru
 
 	/* We need to handle NMIs before interrupts are enabled */
 	if ((exit_intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR &&
-	    (exit_intr_info & INTR_INFO_VALID_MASK))
+	    (exit_intr_info & INTR_INFO_VALID_MASK)) {
+		kvm_before_handle_nmi(&vmx->vcpu);
 		asm("int $2");
+		kvm_after_handle_nmi(&vmx->vcpu);
+	}
 
 	idtv_info_valid = idt_vectoring_info & VECTORING_INFO_VALID_MASK;
 
arch/x86/kvm/x86.c +46 -0

70 lines not on this page · raw message

arch/x86/kvm/x86.h +3 -0
diff -Nraup linux-2.6_tip0417/arch/x86/kvm/x86.h linux-2.6_tip0417_perfkvm/arch/x86/kvm/x86.h
@@ -65,4 +65,7 @@ static inline int is_paging(struct kvm_v
 	return kvm_read_cr0_bits(vcpu, X86_CR0_PG);
 }
 
+void kvm_before_handle_nmi(struct kvm_vcpu *vcpu);
+void kvm_after_handle_nmi(struct kvm_vcpu *vcpu);
+
 #endif