From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
kvm <kvm@vger.kernel.org>, "Radim Krčmář" <rkrcmar@redhat.com>,
"Wanpeng Li" <wanpeng.li@hotmail.com>
Subject: Re: [PATCH] KVM: VMX: Fix losing blocking by NMI in the guest interruptibility-state field
Date: Tue, 25 Jul 2017 10:48:54 +0200 [thread overview]
Message-ID: <e4117dfe-3a55-b23e-b0bc-dd7a7b6cc861@redhat.com> (raw)
In-Reply-To: <CANRm+CxjjJr8360q44nVSz33KyPQoaucfrFiD8to=Y86yKMOvA@mail.gmail.com>
On 25/07/2017 10:27, Wanpeng Li wrote:
> 2017-07-14 19:36 GMT+08:00 Paolo Bonzini <pbonzini@redhat.com>:
>> On 14/07/2017 11:39, Wanpeng Li wrote:
>>> However, commit 0be9c7a89f750 (KVM: VMX: set "blocked by NMI" flag if EPT
>>> violation happens during IRET from NMI) just fixes the fault due to EPT violation.
>>> This patch tries to fix the fault due to the page fault of shadow page table.
>>>
>>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>>> Cc: Radim Krčmář <rkrcmar@redhat.com>
>>> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
>>> ---
>>> arch/x86/kvm/vmx.c | 5 +++++
>>> 1 file changed, 5 insertions(+)
>>>
>>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>>> index 84e62ac..32ca063 100644
>>> --- a/arch/x86/kvm/vmx.c
>>> +++ b/arch/x86/kvm/vmx.c
>>> @@ -5709,6 +5709,11 @@ static int handle_exception(struct kvm_vcpu *vcpu)
>>> }
>>>
>>> if (is_page_fault(intr_info)) {
>>> +
>>> + if (!(to_vmx(vcpu)->idt_vectoring_info & VECTORING_INFO_VALID_MASK) &&
>>> + (intr_info & INTR_INFO_UNBLOCK_NMI))
>>> + vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO, GUEST_INTR_STATE_NMI);
>>> +
>>> cr2 = vmcs_readl(EXIT_QUALIFICATION);
>>> /* EPT won't cause page fault directly */
>>> WARN_ON_ONCE(!vcpu->arch.apf.host_apf_reason && enable_ept);
>>
>> vmx_recover_nmi_blocking is supposed to do the same. EPT and PML-full exits
>> need separate code because they store bit 12 in the exit qualification rather
>> than the VM-exit interruption info. I think the bug is in the handling of
>> vmx->nmi_known_unmasked.
>>
>> The following patch fixes it for me, can you test it too?
>
> Sorry, I just touch my testing machine recently and had a traveling
> before. It seems that the patch is correct for itself, but it still
> can't fix the issue which I encounter. Actually, L1 injects NMI to L2
> kvm-unit-tests/event.flat and mark the cached value of the guest
> interruptibility info is masked, however, it is marked in the L1 and
> L0 can't know what's the right value of the cached info should be. We
> lost the right value of the cached info on L0, and the cached info is
> unmask so vmx_recover_nmi_blocking can't handle it. So I'm afraid the
> original patch also should be applied.
No, the original patch is wrong. Handling intr_info &
INTR_INFO_UNBLOCK_NMI is vmx_recover_nmi_blocking's task. Are you
saying that nmi_known_unmasked must be updated when preparing the vmcs02
for the vmcs12?
Thanks,
Paolo
prev parent reply other threads:[~2017-07-25 8:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-14 9:39 Wanpeng Li
2017-07-14 11:36 ` Paolo Bonzini
2017-07-14 12:22 ` Wanpeng Li
2017-07-25 8:27 ` Wanpeng Li
2017-07-25 8:48 ` 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=e4117dfe-3a55-b23e-b0bc-dd7a7b6cc861@redhat.com \
--to=pbonzini@redhat.com \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rkrcmar@redhat.com \
--cc=wanpeng.li@hotmail.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®