From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v3] KVM: x86: Fix nmi injection failure when vcpu got blocked Date: Tue, 30 May 2017 17:15:39 +0200 Message-ID: <48bd9449-cb91-c585-49b6-e90e7a696297@redhat.com> References: <1495775808-10396-1-git-send-email-ann.zhuangyanying@huawei.com> <20170530133605.GA18926@potion> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: herongguang.he@huawei.com, qemu-devel@nongnu.org, arei.gonglei@huawei.com, oscar.zhangbo@huawei.com, kvm@vger.kernel.org To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Zhuangyanying Return-path: Received: from mail-wm0-f49.google.com ([74.125.82.49]:36819 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750733AbdE3PPm (ORCPT ); Tue, 30 May 2017 11:15:42 -0400 Received: by mail-wm0-f49.google.com with SMTP id 7so94680967wmo.1 for ; Tue, 30 May 2017 08:15:42 -0700 (PDT) In-Reply-To: <20170530133605.GA18926@potion> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 30/05/2017 15:36, Radim Krčmář wrote: >> - if (atomic_read(&vcpu->arch.nmi_queued)) >> + if (kvm_test_request(KVM_REQ_NMI, vcpu) || >> + (vcpu->arch.nmi_pending && > I think the logic should be > > if ((kvm_test_request(KVM_REQ_NMI, vcpu) || vcpu->arch.nmi_pending) && > kvm_x86_ops->nmi_allowed(vcpu)) > > because there is no reason to resume the VCPU if we cannot inject. KVM_REQ_NMI would be processed anyway, and would clear nmi_queued. Of course, it would very soon go back to sleep. Even before Yanying's patch, nmi_queued > 0 would have woken up the vCPU in this manner. So I'm applying the patch. Thanks! Paolo