[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f8faa85e-24e6-4105-ab83-87b1b8c4bd56@amazon.com>
Date: Thu, 21 Nov 2024 18:10:07 +0000
From: Nikita Kalyazin <kalyazin@...zon.com>
To: Vitaly Kuznetsov <vkuznets@...hat.com>
CC: <pbonzini@...hat.com>, <seanjc@...gle.com>, <tglx@...utronix.de>,
<mingo@...hat.com>, <bp@...en8.de>, <dave.hansen@...ux.intel.com>,
<hpa@...or.com>, <kvm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<david@...hat.com>, <peterx@...hat.com>, <oleg@...hat.com>,
<gshan@...hat.com>, <graf@...zon.de>, <jgowans@...zon.com>,
<roypat@...zon.co.uk>, <derekmn@...zon.com>, <nsaenz@...zon.es>,
<xmarcalx@...zon.com>
Subject: Re: [PATCH] KVM: x86: async_pf: check earlier if can deliver async pf
On 18/11/2024 17:58, Vitaly Kuznetsov wrote:
> Nikita Kalyazin <kalyazin@...zon.com> writes:
>
>> On x86, async pagefault events can only be delivered if the page fault
>> was triggered by guest userspace, not kernel. This is because
>> the guest may be in non-sleepable context and will not be able
>> to reschedule.
>
> We used to set KVM_ASYNC_PF_SEND_ALWAYS for Linux guests before
>
> commit 3a7c8fafd1b42adea229fd204132f6a2fb3cd2d9
> Author: Thomas Gleixner <tglx@...utronix.de>
> Date: Fri Apr 24 09:57:56 2020 +0200
>
> x86/kvm: Restrict ASYNC_PF to user space
>
> but KVM side of the feature is kind of still there, namely
>
> kvm_pv_enable_async_pf() sets
>
> vcpu->arch.apf.send_user_only = !(data & KVM_ASYNC_PF_SEND_ALWAYS);
>
> and then we check it in
>
> kvm_can_deliver_async_pf():
>
> if (vcpu->arch.apf.send_user_only &&
> kvm_x86_call(get_cpl)(vcpu) == 0)
> return false;
>
> and this can still be used by some legacy guests I suppose. How about
> we start with removing this completely? It does not matter if some
> legacy guest wants to get an APF for CPL0, we are never obliged to
> actually use the mechanism.
If I understand you correctly, the change you propose is rather
orthogonal to the original one as the check is performed after the work
has been already allocated (in kvm_setup_async_pf). Would you expect
tangible savings from omitting the send_user_only check?
>
> --
> Vitaly
Powered by blists - more mailing lists