KVM: SVM: Add support for perf-kvm
authorJoerg Roedel <joerg.roedel@amd.com>
Fri, 14 Jan 2011 15:45:02 +0000 (16:45 +0100)
committerMarcelo Tosatti <mtosatti@redhat.com>
Thu, 17 Mar 2011 16:08:25 +0000 (13:08 -0300)
This patch adds the necessary code to run perf-kvm on AMD
machines.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/svm.c

index 63fec1531e89be18889e0bfd240191c2954f03ac..bfb49489566e3e73c9d236a5a828c599aab75fdf 100644 (file)
@@ -3647,13 +3647,21 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
 
        local_irq_disable();
 
-       stgi();
-
        vcpu->arch.cr2 = svm->vmcb->save.cr2;
        vcpu->arch.regs[VCPU_REGS_RAX] = svm->vmcb->save.rax;
        vcpu->arch.regs[VCPU_REGS_RSP] = svm->vmcb->save.rsp;
        vcpu->arch.regs[VCPU_REGS_RIP] = svm->vmcb->save.rip;
 
+       if (unlikely(svm->vmcb->control.exit_code == SVM_EXIT_NMI))
+               kvm_before_handle_nmi(&svm->vcpu);
+
+       stgi();
+
+       /* Any pending NMI will happen here */
+
+       if (unlikely(svm->vmcb->control.exit_code == SVM_EXIT_NMI))
+               kvm_after_handle_nmi(&svm->vcpu);
+
        sync_cr8_to_lapic(vcpu);
 
        svm->next_rip = 0;