On Sun, 20 Sep 2026 21:49:29 +0100 David Woodhouse wrote: > > Replace the per-cache rwlock with a dedicated per-VM atomic SRCU > domain (kvm->gpc_srcu) for the read side. Readers now run under > srcu_read_lock_atomic() alone — preemption disabled and non-blocking > enforced, which every GPC read-side section already satisfied as a > former rwlock critical section. It works in any context > (including hardirq and sched-out paths) and never fails or spins, > eliminating the > read_trylock() contortions in the atomic paths, the double-lock dance > with the lockdep subclass hack in the runstate update, and the > PREEMPT_RT problems inherent to taking an rwlock in those contexts. > In particular, kvm_xen_set_evtchn_fast() is called from hardirq > context (timer callback, kvm_arch_set_irq_inatomic()), where taking > gpc->lock is a sleeping-lock-in-atomic-context bug on PREEMPT_RT. > Given the preempt_disable() in srcu_read_lock_atomic(), as PREEMPT_RT has no way of handling preempt_disable(), you need to add another version of srcu_read_lock_atomic() with preempt_disable() replaced with something like rcu_read_lock().
- [PATCH 00/17] KVM: Use atomic SRCU for gfn-to-pfn cache, r... David Woodhouse
- [PATCH 04/17] KVM: x86/xen: Don't dirty track "v... David Woodhouse
- [PATCH 16/17] KVM: nSVM: Cache L1's IO permissions ma... David Woodhouse
- [PATCH 17/17] KVM: selftests: Add nested transition b... David Woodhouse
- [PATCH 12/17] KVM: selftests: Add nested VMX APIC cac... David Woodhouse
- [PATCH 11/17] KVM: nVMX: Use pinned pfncache for L1 A... David Woodhouse
- [PATCH 03/17] KVM: x86/xen: Explicitly tag "shar... David Woodhouse
- [PATCH 01/17] KVM: pfncache: Use atomic SRCU for read... David Woodhouse
- Re: [PATCH 01/17] KVM: pfncache: Use atomic SRCU ... Hillf Danton
- [PATCH 15/17] KVM: nSVM: Cache L1's MSR permissions m... David Woodhouse
- [PATCH 13/17] KVM: x86: Move nested GPC lock helpers ... David Woodhouse
- [PATCH 14/17] KVM: nSVM: Use a gfn_to_pfn_cache for t... David Woodhouse
- [PATCH 10/17] KVM: nVMX: Implement cache for L1 MSR b... David Woodhouse
- [PATCH 09/17] KVM: x86: Post KVM_REQ_GET_NESTED_STATE... David Woodhouse
- [PATCH 07/17] KVM: pfncache: Add guest-mode pinning (... David Woodhouse
- [PATCH 06/17] KVM: x86: Use gfn_to_pfn_cache for stea... David Woodhouse
- [PATCH 08/17] KVM: pfncache: Return -EAGAIN for a loo... David Woodhouse
- [PATCH 05/17] KVM: x86: Request the guest TLB flush f... David Woodhouse
- [PATCH 02/17] KVM: x86/xen: Extract delivery of event... David Woodhouse

