Re: [RFC V1 11/16] arm64/mm: Route all pgtable atomics to central helpers

From: David Hildenbrand (Arm)

Date: Wed Apr 15 2026 - 06:38:50 EST


On 4/10/26 06:02, Anshuman Khandual wrote:
> On 08/04/26 5:58 PM, David Hildenbrand (Arm) wrote:
>> On 2/24/26 06:11, Anshuman Khandual wrote:
>>> Route all cmpxchg() operations performed on various page table entries to a
>>> new ptdesc_cmpxchg_relaxed() helper. Similarly route all xchg() operations
>>> performed on page table entries to a new ptdesc_xchg_relaxed() helper.
>>>
>>> Currently these helpers just forward to the same APIs that were previously
>>> called direct, but in future we will change the routing for D128 which is
>>> too long to use the standard APIs.
>>>
>>> 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 | 23 +++++++++++++++++------
>>> arch/arm64/mm/fault.c | 2 +-
>>> 2 files changed, 18 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
>>> index 42124d2f323d..cf69ce68f951 100644
>>> --- a/arch/arm64/include/asm/pgtable.h
>>> +++ b/arch/arm64/include/asm/pgtable.h
>>> @@ -87,6 +87,17 @@ static inline void arch_leave_lazy_mmu_mode(void)
>>> #define ptdesc_get(x) READ_ONCE(x)
>>> #define ptdesc_set(x, val) WRITE_ONCE(x, val)
>>>
>>> +static inline ptdesc_t ptdesc_cmpxchg_relaxed(ptdesc_t *ptep, ptdesc_t old,
>>> + ptdesc_t new)
>>> +{
>>> + return cmpxchg_relaxed(ptep, old, new);
>>> +}
>>> +
>>> +static inline ptdesc_t ptdesc_xchg_relaxed(ptdesc_t *ptep, ptdesc_t new)
>>> +{
>>> + return xchg_relaxed(ptep, new);
>>> +}
>>> +
>>
>> We really want the rename of ptdesc_t before this change.
>>
>
> Planning to rename ptdesc_t as ptent_t in a pre-requisite
> patch early in the series.

Good. As discussed, something that contains "pxx" might be clearer than
something that includes "pte".

--
Cheers,

David