[PATCH V4 0/4] arm64/mm: Convert pgtable READ_ONCE() as pxdp_get()

Anshuman Khandual anshuman.khandual at arm.com
Thu Nov 12 22:47:55 PST 2026


On Fri, Nov 13, 2026 at 08:58:51AM +0530, Anshuman Khandual wrote:
> On Thu, Nov 05, 2026 at 10:03:59AM +0530, Anshuman Khandual wrote:
> > Route READ_ONCE() accesses on pgtable entries via level specific generic MM
> > pxdp_get() helpers which platforms could then override when required. These
> > accessors on arm64, will help in ensuring page table accesses are performed
> > in an atomic manner while reading 128 bit page table entries later. But for
> > now they just default to READ_ONCE(), thus preserving existing behaviour on
> > current D64 translation a well.
> > 
> > This is similar to generic MM where all atomic accesses have already been
> > converted from READ_ONCE() into pgtable level specific accessors.
> > 
> > These are preparatory patches for D128 enablement, although standing their
> > own for D64 translation as well. These patches are split from earlier D128
> > V1 series. There are no functional changes here, and besides mm kselftests
> > do not show any regression.
> > 
> > https://lore.kernel.org/linux-mm/20260729122452.3797443-1-anshuman.khandual@arm.com/
> > 
> > This series applies on v7.4-rc1 and have been hosted below for reference.
> > 
> > git at git.gitlab.arm.com:linux-arm/linux-anshuman.git (arm64_pxdp_get_v4)
> > 
> > Changes in V4:
> > 
> > - Dropped all pxdp_get() platform overrides per Catalin
> > - Moved pmdp_test_and_clear_young() and [pud|p4d]_offset[_phys]()
> >   helpers inside arch/arm64/mm/mmu.c to avoid build problems
> > - Updated all commit messages as required
> 
> This series has run into some KASAN fault issues during boot with 5 level
> pgtables but also unlike Sashio suggestions these would require more code
> churn to fix. Please find the details below.
> 
> https://lore.kernel.org/all/ohyhflzuoxdemccemutoosmj5hsfwylrlt6tvnyehulerk7gf3@ada6wu4zrzkp/
> 
> NOTE: somehow Sashiko had dropped LAKML from the thread although it shows
> up in MM list.
> 
> Given the above scenario, I would suggest falling back on the V3 series,
> that defined and override pxdp_get() helpers for arm64 platform. Although
> similar to generic MM default fallback, they prevented code movement into
> arch/arm64/mm/mmu.c file causing these KASAN issues in the first place.
> 
> https://lore.kernel.org/all/20260924062214.1635078-1-anshuman.khandual@arm.com/
> 
> V3 series apples cleanly, builds, boots and also clears MM selftests on
> v7.4-rc2 as well.

The following upstream commit had changed pxdp_get() arguments as 'const'
(since V3 was posted) which would now require similar changes to be made
in all platform overrides for pxdp_get().

48bd5dc504cc ("constify arguments in default pxdp_get()")

Hence will repost V3 series as V5 after changing the arguments as 'const
pgprot_t *' if there are no other conerns.

> 
> > 
> > Changes in V3:
> > 
> > https://lore.kernel.org/all/20260924062214.1635078-1-anshuman.khandual@arm.com/
> > 
> > - Added overrides for pxdp_get() and replaced remaining READ_ONCE()
> > - Updated all commit messages as required
> > - Dropped previous tags
> > 
> > Changes in V2:
> > 
> > https://lore.kernel.org/all/20260922061638.3967467-1-anshuman.khandual@arm.com/
> > 
> > - Rebased on v7.3-rc4 along with all latest dependencies
> > - Updated commit messages per Ryan
> > - Added tags from Ryan
> > 
> > Changes in V1:
> > 
> > https://lore.kernel.org/all/20260903060657.2717457-1-anshuman.khandual@arm.com/
> > 
> > Cc: Catalin Marinas <catalin.marinas at arm.com>
> > Cc: Will Deacon <will at kernel.org>
> > Cc: Ryan Roberts <ryan.roberts at arm.com>
> > Cc: Mark Rutland <mark.rutland at arm.com>
> > Cc: Lorenzo Stoakes <ljs at kernel.org>
> > Cc: Andrew Morton <akpm at linux-foundation.org>
> > Cc: David Hildenbrand <david at kernel.org>
> > Cc: Mike Rapoport <rppt at kernel.org>
> > Cc: Linu Cherian <linu.cherian at arm.com>
> > Cc: linux-arm-kernel at lists.infradead.org
> > Cc: linux-kernel at vger.kernel.org
> > Cc: linux-mm at kvack.org
> > 
> > Anshuman Khandual (4):
> >   arm64/mm: Use pmdp_get() for PMD accesses
> >   arm64/mm: Use pudp_get() for PUD accesses
> >   arm64/mm: Use p4dp_get() for P4D accesses
> >   arm64/mm: Use pgdp_get() for PGD accesses
> > 
> >  arch/arm64/include/asm/pgtable.h | 38 +++----------
> >  arch/arm64/mm/fault.c            |  8 +--
> >  arch/arm64/mm/fixmap.c           |  6 +-
> >  arch/arm64/mm/hugetlbpage.c      | 10 ++--
> >  arch/arm64/mm/kasan_init.c       | 18 +++---
> >  arch/arm64/mm/mmu.c              | 97 ++++++++++++++++++++++----------
> >  arch/arm64/mm/pageattr.c         |  8 +--
> >  arch/arm64/mm/trans_pgd.c        | 14 ++---
> >  8 files changed, 108 insertions(+), 91 deletions(-)
> > 
> > -- 
> > 2.43.0
> > 



More information about the linux-arm-kernel mailing list