Re: [PATCH 5/5] KVM: x86: move asynchronous page fault handling to vcpu_enter_guest()
From: Sean Christopherson
Date: Thu Nov 05 2026 - 14:14:56 EST
On Thu, Nov 05, 2026, Paolo Bonzini wrote:
> Fully handle the PV async #PF in vcpu_enter_guest(). This has several
> advantages; first of all nested async #PF code (which has more to do
> with host page faults than nested MMU page faults) is moved away from
> MMU page fault handling, second host_apf_flags is hidden (though only
> partly so, because it is replaced by EXIT_FASTPATH_APF) and the node
> put on the stack.
>
> Reported-by: syzbot+f11512d1e5878ba5e60e@xxxxxxxxxxxxxxxxxxxxxxxxx
> Link: https://patch.msgid.link/auqAsEk9o6buPNiR@xxxxxxxxxx
> Co-authored-by: Sean Christopherson <seanjc@xxxxxxxxxx>
> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> ---
> arch/x86/include/asm/kvm_host.h | 6 +++---
> arch/x86/kvm/mmu.h | 21 ++++++++++++---------
> arch/x86/kvm/mmu/mmu.c | 21 ++-------------------
> arch/x86/kvm/svm/nested.c | 4 ----
> arch/x86/kvm/svm/svm.c | 14 +++++++-------
> arch/x86/kvm/vmx/main.c | 20 +++++++++++---------
> arch/x86/kvm/vmx/nested.c | 3 +--
> arch/x86/kvm/vmx/vmx.c | 6 +-----
> arch/x86/kvm/x86.c | 17 +++++++++++++++--
> 9 files changed, 52 insertions(+), 60 deletions(-)
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 93170c70a17c..f72028efe2ca 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -209,6 +209,7 @@ enum exit_fastpath_completion {
> EXIT_FASTPATH_REENTER_GUEST,
> EXIT_FASTPATH_EXIT_HANDLED,
> EXIT_FASTPATH_EXIT_USERSPACE,
> + EXIT_FASTPATH_APF,
Ha! I had coded up EXIT_FASTPATH_PF too, but never proposed it because it wasn't
useful since my approach used a dedicated kvm_x86_ops hook.
I'll take a close look at this series today or tomorrow.