public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: "Pierre-Clément Tosi" <ptosi@google.com>,
	"Caleb Connolly" <caleb.connolly@linaro.org>,
	"Andre Przywara" <andre.przywara@arm.com>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Patrick Rudolph" <patrick.rudolph@9elements.com>,
	"Peter Hoyes" <Peter.Hoyes@arm.com>,
	"Simon Glass" <sjg@chromium.org>,
	"Sumit Garg" <sumit.garg@linaro.org>,
	"Tom Rini" <trini@konsulko.com>,
	u-boot-qcom@groups.io,
	"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
	u-boot@lists.denx.de
Subject: Re: [PATCH] armv8: mmu: don't switch to emergency tlb when adding a dynamic mapping
Date: Tue, 14 Jan 2025 08:55:56 +0000	[thread overview]
Message-ID: <87a5btrcyr.wl-maz@kernel.org> (raw)
In-Reply-To: <25177dc9-628f-4798-9ee8-b1a4a7845b19@pengutronix.de>

On Tue, 14 Jan 2025 08:38:48 +0000,
Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
> 
> Hi Pierre,
> 
> On 08.01.25 16:52, Pierre-Clément Tosi wrote:
> > Hi Caleb,
> > 
> > On Wed, Jan 08, 2025 at 04:19:07PM +0100, Caleb Connolly wrote:
> >> Hi Marc,
> >>
> >> Thanks for your comments.
> >>
> >> On 08/01/2025 16:05, Marc Zyngier wrote:
> >>> On Wed, 08 Jan 2025 14:22:24 +0000,
> >>> Caleb Connolly <caleb.connolly@linaro.org> wrote:
> >>>>
> >>>> This seems to cause crashes on a bunch of Qualcomm platforms. It's safer
> >>>> to just update the live table and flush it.
> >>>
> >>> You may want to provide a bit more information, because that's not
> >>> much to go on, really.
> >>
> >> Best I have is "the board hangs and then resets when trying to switch
> >> pagetables", I didn't manage to narrow it down exactly, but since it
> >> seems to work to update the tables without switching that feels like a
> >> better approach at least for now.
> >>
> >> In hindsight, this mmu_map_region() function is not great in a lot of
> >> ways, I'm still getting my head around the MMU and I expect this will
> >> keep being improved.
> > 
> > Yes, [1] should not have used map_range() on live PTs as it assumes that
> > 
> > 1. the PTs it modifies aren't live so doesn't perform Break Before Make;
> 
> Quoting ARM ARM (L.a) D8.17.1 "Using break-before-make when updating translation
> table entries":
> 
>   If multiple execution threads use the same translation tables, then when a
>   translation table entry is modified in one or more of the following ways,
>   the architecture requires software to use a break-before-make sequence: [...]
> 
> So I am wondering: Does the break-before-make requirement even apply to a
> single-threaded software like U-Boot?

Yes, this equally applies, as the page-table walker is a separate
agent in the system, and can *speculatively* walk page tables any time
it wants. These walks are allowed to be cached as TLBs, and this can
result in a single VA translating to multiple PAs.

Don't do that.

	M.

-- 
Without deviation from the norm, progress is not possible.

      reply	other threads:[~2025-01-14  8:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-08 14:22 [PATCH] armv8: mmu: don't switch to emergency tlb when adding a dynamic mapping Caleb Connolly
2025-01-08 15:05 ` Marc Zyngier
2025-01-08 15:19   ` Caleb Connolly
2025-01-08 15:42     ` Marc Zyngier
2025-01-08 16:07       ` Caleb Connolly
2025-01-10 14:20       ` Neil Armstrong
2025-01-08 15:52     ` Pierre-Clément Tosi
2025-01-14  8:38       ` Ahmad Fatoum
2025-01-14  8:55         ` Marc Zyngier [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=87a5btrcyr.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=Peter.Hoyes@arm.com \
    --cc=a.fatoum@pengutronix.de \
    --cc=andre.przywara@arm.com \
    --cc=caleb.connolly@linaro.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=neil.armstrong@linaro.org \
    --cc=patrick.rudolph@9elements.com \
    --cc=ptosi@google.com \
    --cc=sjg@chromium.org \
    --cc=sumit.garg@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot-qcom@groups.io \
    --cc=u-boot@lists.denx.de \
    /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