From: Will Deacon <will@kernel.org>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Linu Cherian <linu.cherian@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Ryan Roberts <ryan.roberts@arm.com>,
Kevin Brodsky <kevin.brodsky@arm.com>,
Anshuman Khandual <anshuman.khandual@arm.com>,
Yang Shi <yang@os.amperecomputing.com>,
Huang Ying <ying.huang@linux.alibaba.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] arm64: tlbflush: Don't broadcast if mm was only active on local cpu
Date: Wed, 17 Jun 2026 14:58:20 +0100 [thread overview]
Message-ID: <ajKn_Pt50CmOUrsP@willie-the-truck> (raw)
In-Reply-To: <ajDpc1-c2_zhycr6@J2N7QTR9R3>
On Tue, Jun 16, 2026 at 07:13:07AM +0100, Mark Rutland wrote:
> On Mon, Jun 15, 2026 at 03:44:20PM +0100, Will Deacon wrote:
> > On Mon, Jun 15, 2026 at 01:39:43PM +0100, Mark Rutland wrote:
> > > Regardless of the erratum, to correctly handle a vCPU being migrated
> > > from pCPU-x to pCPU-y, we rely on:
> > >
> > > * The host to set HCR_EL2.FB to ensure that TLB maintenance is
> > > broadcast to the ISH domain.
> > >
> > > * The host to set HCR_EL2.BSU to ensure the DSB is upgrade to ISH such
> > > that any guest-issued DSB NSH will it can complete any TLB maintenance
> > > that was upgraded to ISH.
> > >
> > > * The host to issue a DSB ISH on pCPU-x before the vCPU can run on
> > > pCPU-y, to complete any outstanding maintenance that was issued on
> > > pCPU-x. IIUC a DSB ISH on pCPU-y is not architecturally sufficient; it
> > > must be executed on the same CPU which issued the TLB maintenance.
> > >
> > > ... but as above, all of that should be independent of any of the errata
> > > that require the workaround.
> >
> > Yes, I understand all of the above but the case I'm struggling with is
> > where a vCPU runs on a system that needs the TLB invalidation to be
> > performed twice. For non-broadcast invalidation (from the guest
> > perspective), this patch will mean that it only performs the
> > invalidation once. So if the vCPU migrates to another physical CPU, can
> > that effectively undo the HCR_EL2.FB upgrade unless KVM issues TLB
> > invalidation as well as a DSB on migration?
> >
> > Maybe I'm missing something, as it looks like upstream already elides
> > the call to __tlbi_sync_s1ish() for the NOBROADCAST case.
>
> The key thing is that these errata only affect the completion of memory
> accesses, and only those accesses made by other (physical) PEs.
Thanks. That sort of detail isn't generally disclosed in the writeups,
but if you're certain that applies to all of the errata workarounds
selecting CONFIG_ARM64_WORKAROUND_REPEAT_TLBI, then let's rename
that config option and document this somewhere (in the Kconfig help?)
to make sure that anybody trying to use this workaround to e.g. resolve
problems on the broadcasting side, are aware that it won't necessarily
help.
> A single TLBI will correctly remove the actual TLB entries, and
> HCR_EL2.{FB,BSU} will still ensure that TLB entries are removed from the
> TLBs of other PEs.
>
> The errata only prevent completion of memory accesses made on other
> (physical) PEs, and:
>
> * For accesses made by the vCPU which is issuing the TLBI(s):
>
> - Regardless of the errata, the hypervisor has to ensure that when a
> vCPU is migrated from pCPU-x to pCPU-y, any prior CMOs or TLBIs are
> completed, which requires the host to execute a DSB ISH on pCPU-x
> before the vCPU can be run on pCPU-y.
>
> Maybe we have a latent bug here?
I think that should happen in the context switch path (see the
barrier in __switch_to()).
Will
prev parent reply other threads:[~2026-06-17 13:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-23 13:47 [PATCH v2] arm64: tlbflush: Don't broadcast if mm was only active on local cpu Linu Cherian
2026-06-14 11:04 ` Will Deacon
2026-06-14 11:33 ` Will Deacon
2026-06-15 11:21 ` Ryan Roberts
2026-06-15 14:43 ` Will Deacon
2026-06-15 15:41 ` Ryan Roberts
2026-06-16 5:05 ` Linu Cherian
2026-06-16 5:00 ` Linu Cherian
2026-06-18 6:01 ` Linu Cherian
2026-06-16 4:54 ` Linu Cherian
2026-06-15 12:39 ` Mark Rutland
2026-06-15 14:44 ` Will Deacon
2026-06-16 6:13 ` Mark Rutland
2026-06-17 13:58 ` Will Deacon [this message]
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=ajKn_Pt50CmOUrsP@willie-the-truck \
--to=will@kernel.org \
--cc=anshuman.khandual@arm.com \
--cc=catalin.marinas@arm.com \
--cc=kevin.brodsky@arm.com \
--cc=linu.cherian@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=ryan.roberts@arm.com \
--cc=yang@os.amperecomputing.com \
--cc=ying.huang@linux.alibaba.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