KVM: VMX: Fix interrupt loss during race with NMI
authorAvi Kivity <avi@redhat.com>
Thu, 20 Nov 2008 09:47:18 +0000 (11:47 +0200)
committerAvi Kivity <avi@redhat.com>
Sun, 23 Nov 2008 12:52:29 +0000 (14:52 +0200)
If an interrupt cannot be injected for some reason (say, page fault
when fetching the IDT descriptor), the interrupt is marked for
reinjection.  However, if an NMI is queued at this time, the NMI
will be injected instead and the NMI will be lost.

Fix by deferring the NMI injection until the interrupt has been
injected successfully.

Analyzed by Jan Kiszka.

Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/vmx.c

index d06b4dc0e2eac49c3d1df9d78ec4b6d6ad975c4f..a4018b01e1f973bad1619d6ca16e0e67e29aceab 100644 (file)
@@ -3149,7 +3149,9 @@ static void vmx_intr_assist(struct kvm_vcpu *vcpu)
 
        if (cpu_has_virtual_nmis()) {
                if (vcpu->arch.nmi_pending && !vcpu->arch.nmi_injected) {
-                       if (vmx_nmi_enabled(vcpu)) {
+                       if (vcpu->arch.interrupt.pending) {
+                               enable_nmi_window(vcpu);
+                       } else if (vmx_nmi_enabled(vcpu)) {
                                vcpu->arch.nmi_pending = false;
                                vcpu->arch.nmi_injected = true;
                        } else {
This page took 0.030842 seconds and 5 git commands to generate.