> -----Original Message----- > From: Radim Krčmář [mailto:rkrcmar@xxxxxxxxxx] > Sent: Wednesday, May 24, 2017 10:34 PM > To: Zhuangyanying > Cc: pbonzini@xxxxxxxxxx; Herongguang (Stephen); qemu-devel@xxxxxxxxxx; > Gonglei (Arei); Zhangbo (Oscar); kvm@xxxxxxxxxxxxxxx > Subject: Re: [PATCH] Fix nmi injection failure when vcpu got blocked > > Please use tags in patches. > We usually begin the subject with "KVM: x86:" when touching > arch/x86/kvm/x86.c. > Sorry, I will add in patch v2. > 2017-05-24 13:48+0800, Zhuangyanying: > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c @@ -8394,7 > > +8394,8 @@ static inline bool kvm_vcpu_has_events(struct kvm_vcpu *vcpu) > > if (vcpu->arch.pv.pv_unhalted) > > return true; > > > > - if (atomic_read(&vcpu->arch.nmi_queued)) > > + if (vcpu->arch.nmi_pending || > > + atomic_read(&vcpu->arch.nmi_queued)) > > return true; > > Hm, I think we've been missing '&& kvm_x86_ops->nmi_allowed(vcpu)'. > Yes, we've been missing, I will add in patch v2. > The undesired resume if we have suppressed NMI is not making it much worse, > but wouldn't "kvm_test_request(KVM_REQ_NMI, vcpu)" also work here? > > > if (kvm_test_request(KVM_REQ_SMI, vcpu)) > > Thanks. "kvm_test_request(KVM_REQ_NMI, vcpu)", works fine for me.