From: Yeoreum Yun <yeoreum.yun@arm.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Yeoreum Yun <yeoreum.yun@arm.com>,
linux-arm-kernel@lists.infradead.org, will@kernel.org,
mark.rutland@arm.com, akpm@linux-foundation.org,
david@kernel.org, pasha.tatashin@soleen.com,
ryan.roberts@arm.com, rmclure@linux.ibm.com,
baolin.wang@linux.alibaba.com, kevin.brodsky@arm.com,
kas@kernel.org, anshuman.khandual@arm.com
Subject: Re: [PATCH] arm64: mm: clarify necessity of isb() in emit_pte_barriers()'s comments
Date: Thu, 26 Nov 2026 17:21:54 +0000 [thread overview]
Message-ID: <awhqspDavLGWONzZ@e129823.arm.com> (raw)
In-Reply-To: <awhjLLF2YLfcqjWX@arm.com>
> On Wed, Nov 25, 2026 at 06:38:05PM +0000, Yeoreum Yun wrote:
> > The dsb() in emit_pte_barriers() makes the pte store visible to the
> > table walker. However, without FEAT_ETS2, address translation for a
> > subsequent data access may occur speculatively before the dsb() completes,
> > potentially observing the old invalid PTE according to
> > Arm ARM DDI0487 M.d:
> >
> > B2.6.9 Data Synchronization Barrier
> > ...
> > In addition, no instruction that appears in program order after the DSB
> > instruction can alter any state of the system or perform any part of
> > its functionality until the DSB completes other than:
> > ...
> > - If FEAT_ETS2 is not implemented, translating any virtual addresses of
> > instructions that generate Explicit Memory Effects.
> > ...
> >
> > Document this behavior and reference Arm ARM DDI0487 M.d, B2.6.9 to
> > clarify why the dsb() alone is insufficient to prevent a spurious fault.
> >
> > Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
> > ---
> > arch/arm64/include/asm/pgtable.h | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> > index a474c9fb485ad..6101357539f31 100644
> > --- a/arch/arm64/include/asm/pgtable.h
> > +++ b/arch/arm64/include/asm/pgtable.h
> > @@ -45,7 +45,10 @@ static inline void emit_pte_barriers(void)
> > /*
> > * These barriers are emitted under certain conditions after a pte entry
> > * was modified (see e.g. __set_pte_complete()). The dsb makes the store
> > - * visible to the table walker. The isb ensures that any previous
> > + * visible to the table walker.
> > + * However, without FEAT_ETS2, address translation for a subsequent
> > + * data access may occur speculatively before the dsb completes
> > + * (see Arm ARM DDI0487 M.d, B2.6.9). The isb ensures that any previous
> > * speculative "invalid translation" marker that is in the CPU's
> > * pipeline gets cleared, so that any access to that address after
> > * setting the pte to valid won't cause a spurious fault. If the thread
>
> I wonder whether one could read it as the isb() can be dropped if ETS2
> is present, which is not the case. This function is used on the execmem
> path as well where we need the barriers irrespective of ETS2. You may
> want to add another sentence that even with ETS2, we still need the
> barriers for instruction fetches.
Agree. regardless of FEAT_ETS2, it couldn't remove dsb() and isb()
for instruction fetch. but it's the case for data access according to
the NOTE section of ETS-ordered-before or DSB-ordered-before.
What about with below?
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 6101357539f31..36b5d799b0692 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -47,8 +47,11 @@ static inline void emit_pte_barriers(void)
* was modified (see e.g. __set_pte_complete()). The dsb makes the store
* visible to the table walker.
* However, without FEAT_ETS2, address translation for a subsequent
- * data access may occur speculatively before the dsb completes
- * (see Arm ARM DDI0487 M.d, B2.6.9). The isb ensures that any previous
+ * data access and instruction fetches may occur speculatively before
+ * the dsb() completes (see Arm ARM DDI0487 M.d, B2.6.9).
+ * With FEAT_ETS2, this remains possible for instruction fetches,
+ * but not for data access (see ARM ARM DDI0487 M.d, B2.6.7
+ * ETS-ordered-before or DSB-ordered-before). The isb ensures that any previous
* speculative "invalid translation" marker that is in the CPU's
* pipeline gets cleared, so that any access to that address after
* setting the pte to valid won't cause a spurious fault. If the thread
Thanks.
--
Sincerely,
Yeoreum Yun
prev parent reply other threads:[~2026-11-26 17:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 18:38 [PATCH] arm64: mm: clarify necessity of isb() in emit_pte_barriers()'s comments Yeoreum Yun
2026-11-26 7:13 ` Anshuman Khandual
2026-11-26 9:19 ` Yeoreum Yun
2026-11-26 16:49 ` Catalin Marinas
2026-11-26 17:21 ` Yeoreum Yun [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=awhqspDavLGWONzZ@e129823.arm.com \
--to=yeoreum.yun@arm.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=catalin.marinas@arm.com \
--cc=david@kernel.org \
--cc=kas@kernel.org \
--cc=kevin.brodsky@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=pasha.tatashin@soleen.com \
--cc=rmclure@linux.ibm.com \
--cc=ryan.roberts@arm.com \
--cc=will@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.