From: Marc Zyngier <maz@kernel.org>
To: Oliver Upton <oliver.upton@linux.dev>
Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
James Morse <james.morse@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>, Will Deacon <will@kernel.org>
Subject: Re: [PATCH 1/2] KVM: arm64: nvhe: Synchronise with page table walker on MMU update
Date: Fri, 07 Apr 2023 12:37:11 +0100 [thread overview]
Message-ID: <87lej36hzs.wl-maz@kernel.org> (raw)
In-Reply-To: <87mt3k53x9.wl-maz@kernel.org>
On Fri, 07 Apr 2023 12:26:26 +0100,
Marc Zyngier <maz@kernel.org> wrote:
>
> Hi Oliver,
>
> On Thu, 06 Apr 2023 17:56:31 +0100,
> Oliver Upton <oliver.upton@linux.dev> wrote:
> >
> > Hey Marc,
> >
> > On Thu, Mar 30, 2023 at 11:04:18AM +0100, Marc Zyngier wrote:
> > > When taking an exception between the EL1&0 translation regime and
> > > the EL2 translation regime, the page table walker is allowed to
> > > complete the walks started from EL0 or EL1 while running at EL2.
> > >
> > > It means that altering the system registers that define the EL1&0
> > > translation regime is fraught with danger *unless* we wait for
> > > the completion of such walk with a DSB (R_LFHQG and subsequent
> > > statements in the ARM ARM). We already did the right thing for
> > > other external agents (SPE, TRBE), but not the PTW.
> > >
> > > In the case of nVHE, this is a bit involved, as there are a number
> > > of situations where this can happen (such as switching between
> > > host and guest, invalidating TLBs...).
> >
> > I'm assuming that the dsb(ishst) done in some of the other TLB
> > invalidation handlers is sufficient, as R_LFHQG does not describe the
> > scope of the DSB (i.e. loads and/or stores). Nonetheless, short of any
> > special serialization rules, it seems probable for the PTW to have both
> > outstanding loads and stores.
>
> I too find the definition pretty light. My gut feeling is that we're
> not really trying to synchronise against either loads or stores. We
> are simply waiting for the PTW to complete (or give up) potential
> speculative walks.
>
> For TLBIs, we want to make sure that prior writes to the PTs are
> observable, specially as we perform a broadcast invalidation.
>
> But for external agents, we seem to always rely on an dsb(nsh), such
> as for TRBE and SPE. My take is that if it is enough for them, it
> should be enough for the PTW.
I'll also add that dsb(nsh) orders both reads and writes either side
of the barrier.
However, I finally get your point about the TLBI code. It only orders
stores either side of the barrier, and I'm starting to wonder whether
we should upgrade it to dsb(ish)...
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-04-07 11:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 10:04 [PATCH 0/2] KVM: arm64: Synchronise speculative page table walks on translation regime change Marc Zyngier
2023-03-30 10:04 ` [PATCH 1/2] KVM: arm64: nvhe: Synchronise with page table walker on MMU update Marc Zyngier
2023-04-06 16:56 ` Oliver Upton
2023-04-07 11:26 ` Marc Zyngier
2023-04-07 11:37 ` Marc Zyngier [this message]
2023-03-30 10:04 ` [PATCH 2/2] KVM: arm64: vhe: " Marc Zyngier
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=87lej36hzs.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=james.morse@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=oliver.upton@linux.dev \
--cc=suzuki.poulose@arm.com \
--cc=will@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;
as well as URLs for NNTP newsgroup(s).