Re: [PATCH v2 00/20] KVM: Use atomic SRCU for gfn-to-pfn cache, reinstate guest mode for x86 nesting

From: David Woodhouse

Date: Wed Nov 11 2026 - 13:40:16 EST


On Tue, 2026-11-10 at 12:14 -0800, Sean Christopherson wrote:
> On Tue, Nov 10, 2026, David Woodhouse wrote:
> > On Thu, 2026-11-05 at 02:00 +0000, David Woodhouse wrote:
> > > From: David Woodhouse <dwmw@xxxxxxxxxxxx>
> > >
> > > Based on v7.4-rc1 (kvm/next doesn't have the atomic SRCU flavour yet),
> > > this series:
> > >
> > >  • Converts the GPC to use atomic SRCU, ditching the rwlock which was a
> > >    scaling and latency problem, and which PREEMPT_RT hated because it
> > >    turned the rwlock into a sleeping lock¹.
> > >
> > >  • Fixes the pre-existing bugs which torture-testing that conversion
> > >    shook out: a guest-reachable dirty ring overflow from the hypercall
> > >    page write (128 pushes of the same gfn against 64 reserved entries,
> > >    without PML), and a lost TLB flush request in record_steal_time().
> > >
> > >  • Adds KVM_XEN_VCPU_ATTR_TYPE_WRITE_HYPERCALL_PAGE, for VMMs which
> > >    intercept the guest's MSR write and need to replay it from host
> > >    context².
> > >
> > >  • Cleans up the intentional lack of dirty-tracking of Xen shinfo and
> > >    vcpu_info pages (Sean).
> > >
> > >  • Converts steal-time / preempted status to use gfn_to_pfn_cache.
> > >    (Carsten)
> > >
> >
> > I love it when sashiko-bot finds things which my own local runs don't.
> > I'm still iterating on the latter part of the series; I think it
> > probably makes sense to merge the first half (patches 1-9 above), and
> > the nested parts (below) can come later.
> >
> > Sean, what do you think?
>
> Ya, I'm definitely in favor of that.  Even if Sashiko didn't find anything, I
> think I'd want to grab the GUEST_USES_PFN stuff separately.

Cool. Then I'll focus on kvmclock and VSM stuff for now, and come back
to the GPC-nesting fun later. The basic GPC SRCU patches 1-9 in my tree
are still identical to what was posted in this thread, and what I've
been torture-testing all along:

https://git.infradead.org/users/dwmw2/linux.git/shortlog/refs/heads/gpc-srcu-v2-part1

Carsten Stollmaier (1):
KVM: x86: Use gfn_to_pfn_cache for steal time / preempted status

David Woodhouse (5):
KVM: x86/xen: Fill the hypercall page with a single guest write
KVM: x86/xen: Add KVM_XEN_VCPU_ATTR_TYPE_WRITE_HYPERCALL_PAGE
KVM: x86: Request the guest TLB flush from record_steal_time()
KVM: selftests: Actually deactivate the HVA-based shared_info cache in xen_shinfo_test
KVM: pfncache: Use atomic SRCU for readers instead of a rwlock

Sean Christopherson (3):
KVM: x86/xen: Extract delivery of event to vCPU into a separate helper
KVM: x86/xen: Explicitly tag "shared info" page as never being dirty tracked
KVM: x86/xen: Don't dirty track "vCPU info" page


Documentation/virt/kvm/api.rst | 27 +-
arch/x86/include/asm/kvm_host.h | 2 +-
arch/x86/include/uapi/asm/kvm.h | 3 +
arch/x86/kvm/msrs.c | 7 +-
arch/x86/kvm/x86.c | 165 ++++----
arch/x86/kvm/xen.c | 380 ++++++++++-------
include/linux/kvm_host.h | 41 +-
include/linux/kvm_types.h | 38 +-
include/linux/srcu.h | 7 +
tools/testing/selftests/kvm/x86/xen_shinfo_test.c | 2 +-
tools/testing/selftests/kvm/x86/xen_vmcall_test.c | 118 ++++++
virt/kvm/kvm_main.c | 9 +
virt/kvm/pfncache.c | 485 +++++++++++++++++-----
13 files changed, 944 insertions(+), 340 deletions(-)



Attachment: smime.p7s
Description: S/MIME cryptographic signature