From: Avi Kivity Date: Wed, 7 Nov 2007 15:14:18 +0000 (+0200) Subject: KVM: SVM: Defer nmi processing until switch to host state is complete X-Git-Tag: v2.6.24-rc3~153^2~2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56ba47ddbd5af7918bf1acdbe3deb979d0dcd64b;p=linux-2.6 KVM: SVM: Defer nmi processing until switch to host state is complete If we stgi() too soon, nmis can reach the processor even though interrupts are disabled, catching it in a half-switched state. Delay the stgi() until we're done switching. Signed-off-by: Avi Kivity --- diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 3910358db7..7376805c88 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c @@ -1585,10 +1585,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) #endif : "cc", "memory" ); - local_irq_disable(); - - stgi(); - if ((svm->vmcb->save.dr7 & 0xff)) load_db_regs(svm->host_db_regs); @@ -1605,6 +1601,10 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) reload_tss(vcpu); + local_irq_disable(); + + stgi(); + svm->next_rip = 0; }