* [PATCH] arm64: mm: clarify necessity of isb() in emit_pte_barriers()'s comments
@ 2026-11-25 18:38 Yeoreum Yun
2026-11-26 7:13 ` Anshuman Khandual
0 siblings, 1 reply; 3+ messages in thread
From: Yeoreum Yun @ 2026-11-25 18:38 UTC (permalink / raw)
To: linux-arm-kernel
Cc: catalin.marinas, will, mark.rutland, akpm, david, pasha.tatashin,
ryan.roberts, rmclure, baolin.wang, kevin.brodsky, kas,
anshuman.khandual, Yeoreum Yun
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
--
LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] arm64: mm: clarify necessity of isb() in emit_pte_barriers()'s comments
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
0 siblings, 1 reply; 3+ messages in thread
From: Anshuman Khandual @ 2026-11-26 7:13 UTC (permalink / raw)
To: Yeoreum Yun
Cc: linux-arm-kernel, catalin.marinas, will, mark.rutland, akpm,
david, pasha.tatashin, ryan.roberts, rmclure, baolin.wang,
kevin.brodsky, kas
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.
> ...
Above wording checks out in the ARM ARM.
>
> 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.
Documenting FEAT_ETS2 dependence nuance in the comment does make sense.
FEAT_ETS2 is mandatory from Armv8.8 onwards. Hence this might not be a
real issue on the field ?
>
> 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
> --
> LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] arm64: mm: clarify necessity of isb() in emit_pte_barriers()'s comments
2026-11-26 7:13 ` Anshuman Khandual
@ 2026-11-26 9:19 ` Yeoreum Yun
0 siblings, 0 replies; 3+ messages in thread
From: Yeoreum Yun @ 2026-11-26 9:19 UTC (permalink / raw)
To: Anshuman Khandual
Cc: Yeoreum Yun, linux-arm-kernel, catalin.marinas, will,
mark.rutland, akpm, david, pasha.tatashin, ryan.roberts, rmclure,
baolin.wang, kevin.brodsky, kas
Hi Anshuman,
> 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.
> > ...
>
> Above wording checks out in the ARM ARM.
>
> >
> > 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.
>
> Documenting FEAT_ETS2 dependence nuance in the comment does make sense.
> FEAT_ETS2 is mandatory from Armv8.8 onwards. Hence this might not be a
> real issue on the field ?
Right, the intention is to clarify the existing barriers.
[...]
--
Sincerely,
Yeoreum Yun
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-26 9:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox