On 23/03/2016 06:08, Yuki Shibuya wrote: > + /* If nmi pending > 0 and injectable interrupts exist, > + * nmi pending counter is cleared to prevent skipping > + * injectable pending interrupts. > + */ > + if (vcpu->arch.nmi_pending && kvm_cpu_has_injectable_intr(vcpu) > + && kvm_x86_ops->interrupt_allowed(vcpu)) > + vcpu->arch.nmi_pending = 0; I am not sure I understand this. Why is it safe to drop nmi_pending? Can we instead do something like this in vcpu_enter_guest? It would be nice to have a testcase for this in kvm-unit-tests. Paolo diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 7236bd3a4c3d..6c73cbc8e19a 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -6561,10 +6561,12 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) if (inject_pending_event(vcpu, req_int_win) != 0) req_immediate_exit = true; /* enable NMI/IRQ window open exits if needed */ - else if (vcpu->arch.nmi_pending) - kvm_x86_ops->enable_nmi_window(vcpu); - else if (kvm_cpu_has_injectable_intr(vcpu) || req_int_win) - kvm_x86_ops->enable_irq_window(vcpu); + else { + if (vcpu->arch.nmi_pending) + kvm_x86_ops->enable_nmi_window(vcpu); + if (kvm_cpu_has_injectable_intr(vcpu) || req_int_win) + kvm_x86_ops->enable_irq_window(vcpu); + } if (kvm_lapic_enabled(vcpu)) { update_cr8_intercept(vcpu); Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html