[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9c0125cd-bf69-50f6-7fe8-2b8d860bde04@redhat.com>
Date: Fri, 11 Feb 2022 12:16:29 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
vkuznets@...hat.com, mlevitsk@...hat.com, dmatlack@...gle.com
Subject: Re: [PATCH 03/12] KVM: x86: do not deliver asynchronous page faults
if CR0.PG=0
On 2/11/22 00:16, Sean Christopherson wrote:
> Third time's a charm...
>
> if (kvm_pv_async_pf_enabled(vcpu))
> return false;
>
> if (vcpu->arch.apf.send_user_only &&
> static_call(kvm_x86_get_cpl)(vcpu) == 0)
> return false;
>
> /* L1 CR0.PG=1 is guaranteed if the vCPU is in guest mode (L2). */
> if (is_guest_mode(vcpu))
> return !vcpu->arch.apf.delivery_as_pf_vmexit;
>
> return is_paging(vcpu);
>
>
Went for this, but with slightly different final "if":
if (is_guest_mode(vcpu)) {
/*
* L1 needs to opt into the special #PF vmexits that are
* used to deliver async page faults.
*/
return vcpu->arch.apf.delivery_as_pf_vmexit;
} else {
/*
* Play it safe in case the guest does a quick real mode
* foray. The real mode IDT is unlikely to have a #PF
* exception setup.
*/
return is_paging(vcpu);
}
Paolo
Powered by blists - more mailing lists