From: Sean Christopherson <seanjc@google.com>
To: James Houghton <jthoughton@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH] KVM: x86/mmu: Always guard rmaps with mmu_lock on PREEMPT_RT=y kernels
Date: Wed, 2 Sep 2026 15:27:19 -0700 [thread overview]
Message-ID: <apiixwndH6vY_BQX@google.com> (raw)
In-Reply-To: <CADrL8HULbB2HUSOJ0ivZnkz7V4Ok_jgDQk3hAc0tR6NKHp+6-g@mail.gmail.com>
On Wed, Sep 02, 2026, James Houghton wrote:
> On Wed, Sep 2, 2026 at 2:29 PM Sean Christopherson <seanjc@google.com> wrote:
> > @@ -1745,11 +1776,15 @@ static bool kvm_rmap_age_gfn_range(struct kvm *kvm,
> > gfn_t gfn;
> > int level;
> >
> > +#ifdef CONFIG_PREEMPT_RT
> > + guard(read_lock)(&kvm->mmu_lock);
> > +#endif
>
> Future me would be happier if there were a comment here. :)
>
> Also, how about BUILD_BUG_ON(!CONFIG_KVM_MMU_LOCKLESS_AGING)?
I completely forgot we even had that Kconfig. I'm somewhat tempted to gate the
alternative implementation on KVM_MMU_LOCKLESS_AGING=n, not take mmu_lock here,
and then "select KVM_MMU_LOCKLESS_AGING if PREEMPT_RT=n".
My main hesitation is that taking mmu_lock for read would be impossible without
extending kvm_handle_hva_range() even further, which IMO isn't worth doing unless
multiple architectures want to take mmu_lock for read.
Ugh, I shouldn't have thought those thoughts. s390 does exactly that.
Oh, wait, never mind. That doesn't work for x86, because we want truly lockless
aging for the TDP MMU. So ignore that train of thought, this patch is the way
to go. +1 to adding a BUILD_BUG_ON() and comment thought.
next prev parent reply other threads:[~2026-09-02 22:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 21:17 Sean Christopherson
2026-09-02 21:42 ` James Houghton
2026-09-02 22:27 ` Sean Christopherson [this message]
2026-09-02 22:38 ` 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=apiixwndH6vY_BQX@google.com \
--to=seanjc@google.com \
--cc=dwmw2@infradead.org \
--cc=jthoughton@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.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®