mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 00/17] KVM: Use atomic SRCU for gfn-to-pfn cache, reinstate guest mode for x86 nesting
@ 2026-09-20 20:49 David Woodhouse
  2026-09-20 20:49 ` [PATCH 01/17] KVM: pfncache: Use atomic SRCU for readers instead of a rwlock David Woodhouse
                   ` (16 more replies)
  0 siblings, 17 replies; 27+ messages in thread
From: David Woodhouse @ 2026-09-20 20:49 UTC (permalink / raw)
  To: kvm
  Cc: linux-kernel, rcu, linux-rt-devel, linux-kselftest,
	Paolo Bonzini, Sean Christopherson, Paul Durrant,
	Vitaly Kuznetsov, Fred Griffoul, Paul E. McKenney, Kunwu Chan,
	Kunwu Chan, Zqiang, Boqun Feng, Neeraj Upadhyay, Joel Fernandes,
	Lai Jiangshan, Josh Triplett, Mathieu Desnoyers,
	Sebastian Andrzej Siewior, Clark Williams, Steven Rostedt,
	Jason Gunthorpe, Michal Hocko, Nikita Kalyazin, Keir Fraser,
	David Matlack, nh-open-source

Now that Paul et al have so kindly provided atomic SRCU for us, it would
be churlish not to use it.

Based on the merge of kvm/next (d4b7fb647204) with Paul's dev.2026.09.17a¹
as posted last week², 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.

 • 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)
  
 • Reinstates guest-mode pinning: replacing the old GUEST_USES_PFN mode,
   letting nested state pages be cached and pinned while in guest context.
  
 • nVMX: Uses GPC for the L1 MSR bitmap, and guest mode for APIC access
   and vAPIC pages. (Fred)

 • nSVM: Uses GPC for vmcb12 / MSR-permissions / IO-permissions pages. This
   cuts the vmcb12 transition cost measurably (selftest included).

 • Returns -EAGAIN from cache lookups which race with memslot updates,
   and re-posts KVM_REQ_GET_NESTED_STATE_PAGES on memslot generation
   bumps so pinned caches are revalidated lazily.

Tested: rcutorture atomic-SRCU (srcud, reader_flavor=0x10) on three
hosts; KVM selftests including new invalidation and transition tests;
>1 week soak of VM lifecycle + invalidation reproducers on 128-way
RT+KASAN+lockdep, 192-way RT and 192-way PREEMPT_DYNAMIC hosts. And
booted an actual Xen guest in QEMU a few times...

¹ https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev.2026.09.17a
² https://lore.kernel.org/rcu/20260919003521.3134552-1-paulmck@kernel.org/

There have been previous series which attempt to deal with various parts
of GPC locking, and the steal time one has definitely been posted before
a few times, but let's just call this v1:
https://git.infradead.org/?p=users/dwmw2/linux.git;a=shortlog;h=refs/heads/gpc-srcu

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

David Woodhouse (10):
      KVM: pfncache: Use atomic SRCU for readers instead of a rwlock
      KVM: x86: Request the guest TLB flush from record_steal_time()
      KVM: pfncache: Add guest-mode pinning (GUEST_USES_PFN successor)
      KVM: pfncache: Return -EAGAIN for a lookup which hits an invalid memslot
      KVM: x86: Post KVM_REQ_GET_NESTED_STATE_PAGES on memslot updates
      KVM: x86: Move nested GPC lock helpers to x86.h as kvm_gpc_lock_page()
      KVM: nSVM: Use a gfn_to_pfn_cache for the vmcb12 page
      KVM: nSVM: Cache L1's MSR permissions map pages
      KVM: nSVM: Cache L1's IO permissions map pages
      KVM: selftests: Add nested transition benchmark

Fred Griffoul (3):
      KVM: nVMX: Implement cache for L1 MSR bitmap
      KVM: nVMX: Use pinned pfncache for L1 APIC virtualization pages
      KVM: selftests: Add nested VMX APIC cache invalidation test

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


 arch/x86/include/asm/kvm_host.h                    |   2 +-
 arch/x86/kvm/msrs.c                                |   7 +-
 arch/x86/kvm/svm/nested.c                          | 112 +++-
 arch/x86/kvm/svm/svm.h                             |  16 +
 arch/x86/kvm/vmx/nested.c                          | 356 ++++++++++--
 arch/x86/kvm/vmx/vmx.c                             |  11 +-
 arch/x86/kvm/vmx/vmx.h                             |  16 +-
 arch/x86/kvm/x86.c                                 | 181 ++++---
 arch/x86/kvm/x86.h                                 |  33 ++
 arch/x86/kvm/xen.c                                 | 279 +++++-----
 include/linux/kvm_host.h                           |  86 ++-
 include/linux/kvm_types.h                          |  52 +-
 include/linux/srcu.h                               |   7 +
 tools/testing/selftests/kvm/Makefile.kvm           |   2 +
 .../selftests/kvm/x86/nested_transition_bench.c    | 204 +++++++
 .../selftests/kvm/x86/vmx_apic_update_test.c       | 299 +++++++++++
 virt/kvm/kvm_main.c                                |   9 +
 virt/kvm/pfncache.c                                | 596 +++++++++++++++++----
 18 files changed, 1876 insertions(+), 392 deletions(-)

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2026-09-21  1:43 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-20 20:49 [PATCH 00/17] KVM: Use atomic SRCU for gfn-to-pfn cache, reinstate guest mode for x86 nesting David Woodhouse
2026-09-20 20:49 ` [PATCH 01/17] KVM: pfncache: Use atomic SRCU for readers instead of a rwlock David Woodhouse
2026-09-20 21:55   ` sashiko-bot
2026-09-21  1:42   ` Hillf Danton
2026-09-20 20:49 ` [PATCH 02/17] KVM: x86/xen: Extract delivery of event to vCPU into a separate helper David Woodhouse
2026-09-20 20:49 ` [PATCH 03/17] KVM: x86/xen: Explicitly tag "shared info" page as never being dirty tracked David Woodhouse
2026-09-20 20:49 ` [PATCH 04/17] KVM: x86/xen: Don't dirty track "vCPU info" page David Woodhouse
2026-09-20 20:49 ` [PATCH 05/17] KVM: x86: Request the guest TLB flush from record_steal_time() David Woodhouse
2026-09-20 20:49 ` [PATCH 06/17] KVM: x86: Use gfn_to_pfn_cache for steal time / preempted status David Woodhouse
2026-09-20 22:06   ` sashiko-bot
2026-09-20 20:49 ` [PATCH 07/17] KVM: pfncache: Add guest-mode pinning (GUEST_USES_PFN successor) David Woodhouse
2026-09-20 21:53   ` sashiko-bot
2026-09-20 20:49 ` [PATCH 08/17] KVM: pfncache: Return -EAGAIN for a lookup which hits an invalid memslot David Woodhouse
2026-09-20 21:53   ` sashiko-bot
2026-09-20 20:49 ` [PATCH 09/17] KVM: x86: Post KVM_REQ_GET_NESTED_STATE_PAGES on memslot updates David Woodhouse
2026-09-20 20:49 ` [PATCH 10/17] KVM: nVMX: Implement cache for L1 MSR bitmap David Woodhouse
2026-09-20 21:56   ` sashiko-bot
2026-09-20 20:49 ` [PATCH 11/17] KVM: nVMX: Use pinned pfncache for L1 APIC virtualization pages David Woodhouse
2026-09-20 21:57   ` sashiko-bot
2026-09-20 20:49 ` [PATCH 12/17] KVM: selftests: Add nested VMX APIC cache invalidation test David Woodhouse
2026-09-20 21:51   ` sashiko-bot
2026-09-20 20:49 ` [PATCH 13/17] KVM: x86: Move nested GPC lock helpers to x86.h as kvm_gpc_lock_page() David Woodhouse
2026-09-20 20:49 ` [PATCH 14/17] KVM: nSVM: Use a gfn_to_pfn_cache for the vmcb12 page David Woodhouse
2026-09-20 20:49 ` [PATCH 15/17] KVM: nSVM: Cache L1's MSR permissions map pages David Woodhouse
2026-09-20 20:49 ` [PATCH 16/17] KVM: nSVM: Cache L1's IO " David Woodhouse
2026-09-20 20:49 ` [PATCH 17/17] KVM: selftests: Add nested transition benchmark David Woodhouse
2026-09-20 21:52   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®