Re: [PATCH V2 02/14] arm64/mm: Route all pgtable reads via ptval_get()

From: David Hildenbrand (Arm)

Date: Wed Sep 16 2026 - 09:54:33 EST


On 9/7/26 05:50, Anshuman Khandual wrote:
> Define arm64 platform specific implementations for new pxdp_get() helpers.
> These resolve into READ_ONCE(), thus ensuring required single copy atomic
> semantics for the page table entry reads.
>
> In future this infrastructure can be used for D128 to maintain single copy
> atomicity semantics with inline asm blocks.
>
> Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
> Cc: Will Deacon <will@xxxxxxxxxx>
> Cc: Ryan Roberts <ryan.roberts@xxxxxxx>
> Cc: Mark Rutland <mark.rutland@xxxxxxx>
> Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx>
> ---
> arch/arm64/include/asm/pgtable.h | 38 +++++++++++++++++++++++++++-----
> 1 file changed, 32 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index 83087b70f192..f764132ca34e 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -84,6 +84,32 @@ static inline void arch_leave_lazy_mmu_mode(void)
> arch_flush_lazy_mmu_mode();
> }
>
> +#define ptval_get(x) READ_ONCE(x)
> +
> +#define pmdp_get pmdp_get
> +static inline pmd_t pmdp_get(pmd_t *pmdp)
> +{
> + return ptval_get(*pmdp);
> +}
Ah, one thing: you could pass a const pointer to all these read helpers.

--
Cheers,

David