[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <162c3f40-e413-767b-0b4d-a32208debc87@redhat.com>
Date: Fri, 28 Feb 2020 20:36:44 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Andy Lutomirski <luto@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, X86 ML <x86@...nel.org>,
kvm list <kvm@...r.kernel.org>,
Radim Krcmar <rkrcmar@...hat.com>
Subject: Re: [PATCH] x86/kvm: Handle async page faults directly through
do_page_fault()
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
Powered by blists - more mailing lists