From: Marc Zyngier <maz@kernel.org>
To: Yosry Ahmed <yosry@kernel.org>
Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Steffen Eiden <seiden@linux.ibm.com>,
Joey Gouly <joey.gouly@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Oliver Upton <oupton@kernel.org>,
Zenghui Yu <yuzenghui@huawei.com>
Subject: Re: [PATCH] KVM: arm64: Hold kvm->mmu_lock while initialising vcpu->arch.vncr_tlb
Date: Wed, 10 Jun 2026 11:57:04 +0100 [thread overview]
Message-ID: <868q8mu0hr.wl-maz@kernel.org> (raw)
In-Reply-To: <CAO9r8zMpvxoVcDvWn3q0C0Dv=0Kknt_BqZ8KqddwuKa5bd44Dw@mail.gmail.com>
On Tue, 09 Jun 2026 18:57:26 +0100,
Yosry Ahmed <yosry@kernel.org> wrote:
>
> > > If yes, I think the code looks confusing, at least to a layman like
> > > myself. It initially seems like the lock protects against concurrent
> > > initializations, but then the NULL check is not done again under the
> > > lock. The goal of the lock is not clear without the original report.
> > >
> > > Mayeb it's clearer to explicitly use barriers if the goal is preventing
> > > reordering?
> >
> > This would require both the initialisation of vncr_tlb to use a store
> > release, *and* all the other call sites to use a load acquire.
> >
> > I really don't think it is worth the churn, nor the (very small)
> > burden on the readers.
>
> That's fair. I was mainly just pointing out my initial confusion and
> that others may share it. Avoiding the churn on the readers' side is
> understandable. Maybe a comment here would help explain why the lock
> needs to be held?
I have added this:
/*
* Taking the lock on assignment ensures that the TLB is
* seen as initialised when following the pointer (release
* semantics of the unlock), and avoids having acquires on
* each user which already take the lock.
*/
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2026-06-10 10:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-08 8:11 [PATCH] KVM: arm64: Hold kvm->mmu_lock while initialising vcpu->arch.vncr_tlb Marc Zyngier
2026-06-08 16:34 ` Oliver Upton
2026-06-08 20:55 ` Yosry Ahmed
2026-06-09 7:25 ` Marc Zyngier
2026-06-09 17:57 ` Yosry Ahmed
2026-06-10 10:57 ` Marc Zyngier [this message]
2026-06-10 16:39 ` Yosry Ahmed
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=868q8mu0hr.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=joey.gouly@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=oupton@kernel.org \
--cc=seiden@linux.ibm.com \
--cc=suzuki.poulose@arm.com \
--cc=yosry@kernel.org \
--cc=yuzenghui@huawei.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