From: Paolo Bonzini <pbonzini@redhat.com>
To: Andy Lutomirski <luto@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, X86 ML <x86@kernel.org>,
kvm list <kvm@vger.kernel.org>, Radim Krcmar <rkrcmar@redhat.com>
Subject: Re: [PATCH] x86/kvm: Handle async page faults directly through do_page_fault()
Date: Fri, 28 Feb 2020 20:36:44 +0100 [thread overview]
Message-ID: <162c3f40-e413-767b-0b4d-a32208debc87@redhat.com> (raw)
In-Reply-To: <CALCETrUG0B2QLYYp8h+5KiZ4LpVDZ00XEPsgh4DbbDX9Mx5-EQ@mail.gmail.com>
On 28/02/20 20:04, Andy Lutomirski wrote:
>>> + * We are relying on the interrupted context being sane (valid
>>> + * RSP, relevant locks not held, etc.), which is fine as long as
>>> + * the the interrupted context had IF=1.
>> This is not about IF=0/IF=1; the KVM code is careful about taking
>> spinlocks only with IRQs disabled, and async PF is not delivered if the
>> interrupted context had IF=0. The problem is that the memory location
>> is not reentrant if an NMI is delivered in the wrong window, as you hint
>> below.
>
> If an async PF is delivered with IF=0, then, unless something else
> clever happens to make it safe, we are toast.
Right, it just cannot happen. kvm_can_do_async_pf is where KVM decides
whether a page fault must be handled synchronously, and it does this:
bool kvm_can_do_async_pf(struct kvm_vcpu *vcpu)
{
...
/*
* If interrupts are off we cannot even use an artificial
* halt state.
*/
return kvm_x86_ops->interrupt_allowed(vcpu);
}
The same function is called by kvm_arch_can_inject_async_page_present.
Paolo
prev parent reply other threads:[~2020-02-28 19:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-28 18:42 [PATCH] x86/kvm: Handle async page faults directly through do_page_fault() Andy Lutomirski
2020-02-28 19:00 ` Paolo Bonzini
2020-02-28 19:04 ` Andy Lutomirski
2020-02-28 19:36 ` 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=162c3f40-e413-767b-0b4d-a32208debc87@redhat.com \
--to=pbonzini@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--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