From: Hillf Danton <hdanton@sina.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org,
kvm@vger.kernel.org, linux-rt-devel@lists.linux.dev,
linux-kselftest@vger.kernel.org,
Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <seanjc@google.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: Re: [PATCH 01/17] KVM: pfncache: Use atomic SRCU for readers instead of a rwlock
Date: Mon, 21 Sep 2026 19:21:30 +0800 [thread overview]
Message-ID: <20260921112131.274-1-hdanton@sina.com> (raw)
In-Reply-To: <272c0fdf9e5eb9a1caf6a5c0bf674e3c006ac2ea.camel@infradead.org>
On Mon, 21 Sep 2026 11:54:36 +0200 David Woodhouse wrote:
> On Mon, 2026-09-21 at 09:42 +0800, Hillf Danton wrote:
> > 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().
>
> Hm? What's wrong with preempt_disable()? It works OK, but is generally
How is preempt_disable() handled by RT?
> frowned upon in RT unless the sections are short and bounded of course.
>
Is this patchset going not to work with the preempt_disable() in
srcu_read_lock_atomic() replaced with rcu_read_lock()?
next prev parent reply other threads:[~2026-09-21 11:21 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
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-21 9:54 ` David Woodhouse
2026-09-21 11:21 ` Hillf Danton [this message]
2026-09-21 11:29 ` Paolo Bonzini
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-21 14:17 ` David Woodhouse
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-21 14:31 ` David Woodhouse
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
2026-09-21 14:10 ` [PATCH 00/17] KVM: Use atomic SRCU for gfn-to-pfn cache, reinstate guest mode for x86 nesting David Woodhouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260921112131.274-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=bigeasy@linutronix.de \
--cc=dwmw2@infradead.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=paulmck@kernel.org \
--cc=pbonzini@redhat.com \
--cc=rcu@vger.kernel.org \
--cc=seanjc@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®