From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: kvm@vger.kernel.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
linux-kernel@vger.kernel.org, "Joerg Roedel" <joro@8bytes.org>,
x86@kernel.org
Subject: Re: [PATCH] KVM: nSVM: clear events pending from svm_complete_interrupts() when exiting to L1
Date: Mon, 21 Jan 2019 16:55:46 +0100 [thread overview]
Message-ID: <87d0oq2ef1.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20190107184451.17749-1-vkuznets@redhat.com>
Vitaly Kuznetsov <vkuznets@redhat.com> writes:
> kvm-unit-tests' eventinj "NMI failing on IDT" test results in NMI being
> delivered to the host (L1) when it's running nested. The problem seems to
> be: svm_complete_interrupts() raises 'nmi_injected' flag but later we
> decide to reflect EXIT_NPF to L1. The flag remains pending and we do NMI
> injection upon entry so it got delivered to L1 instead of L2.
>
> It seems that VMX code solves the same issue in prepare_vmcs12(), this was
> introduced with code refactoring in commit 5f3d5799974b ("KVM: nVMX: Rework
> event injection and recovery").
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
> arch/x86/kvm/svm.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 33d4ed6e78a5..db842dafccf0 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -3419,6 +3419,14 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
> kvm_mmu_reset_context(&svm->vcpu);
> kvm_mmu_load(&svm->vcpu);
>
> + /*
> + * Drop what we picked up for L2 via svm_complete_interrupts() so it
> + * doesn't end up in L1.
> + */
> + svm->vcpu.arch.nmi_injected = false;
> + kvm_clear_exception_queue(&svm->vcpu);
> + kvm_clear_interrupt_queue(&svm->vcpu);
> +
> return 0;
> }
Ping?
--
Vitaly
next prev parent reply other threads:[~2019-01-21 15:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-07 18:44 Vitaly Kuznetsov
2019-01-21 15:55 ` Vitaly Kuznetsov [this message]
2019-01-25 17:51 ` Paolo Bonzini
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=87d0oq2ef1.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=x86@kernel.org \
/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
Powered by JetHome