From: Paolo Bonzini <pbonzini@redhat.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>, kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, "Radim Krčmář" <rkrcmar@redhat.com>,
"Brijesh Singh" <brijesh.singh@amd.com>,
"Joerg Roedel" <joro@8bytes.org>
Subject: Re: [PATCH] KVM: x86: svm: make sure NMI is injected after nmi_singlestep
Date: Wed, 10 Apr 2019 11:08:30 +0200 [thread overview]
Message-ID: <b11c9944-832f-9ace-80d6-b1a433e4d78f@redhat.com> (raw)
In-Reply-To: <20190403140642.20760-1-vkuznets@redhat.com>
On 03/04/19 16:06, Vitaly Kuznetsov wrote:
> I noticed that apic test from kvm-unit-tests always hangs on my EPYC 7401P,
> the hanging test nmi-after-sti is trying to deliver 30000 NMIs and tracing
> shows that we're sometimes able to deliver a few but never all.
>
> When we're trying to inject an NMI we may fail to do so immediately for
> various reasons, however, we still need to inject it so enable_nmi_window()
> arms nmi_singlestep mode. #DB occurs as expected, but we're not checking
> for pending NMIs before entering the guest and unless there's a different
> event to process, the NMI will never get delivered.
>
> Make KVM_REQ_EVENT request on the vCPU from db_interception() to make sure
> pending NMIs are checked and possibly injected.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
> - I have to admit my RFC didn't gain much popularity, re-sending as
> non-RFC.
> ---
> arch/x86/kvm/svm.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 426039285fd1..69a0edb23c28 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -2692,6 +2692,7 @@ static int npf_interception(struct vcpu_svm *svm)
> static int db_interception(struct vcpu_svm *svm)
> {
> struct kvm_run *kvm_run = svm->vcpu.run;
> + struct kvm_vcpu *vcpu = &svm->vcpu;
>
> if (!(svm->vcpu.guest_debug &
> (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP)) &&
> @@ -2702,6 +2703,8 @@ static int db_interception(struct vcpu_svm *svm)
>
> if (svm->nmi_singlestep) {
> disable_nmi_singlestep(svm);
> + /* Make sure we check for pending NMIs upon entry */
> + kvm_make_request(KVM_REQ_EVENT, vcpu);
> }
>
> if (svm->vcpu.guest_debug &
>
Queued, thanks.
Paolo
prev parent reply other threads:[~2019-04-10 9:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-03 14:06 Vitaly Kuznetsov
2019-04-10 9:08 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b11c9944-832f-9ace-80d6-b1a433e4d78f@redhat.com \
--to=pbonzini@redhat.com \
--cc=brijesh.singh@amd.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rkrcmar@redhat.com \
--cc=vkuznets@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®