[PATCH 0/8] mm: Drop pxd_ERROR()

Anshuman Khandual posted 8 patches 3 weeks, 5 days ago
There is a newer version of this series
arch/alpha/include/asm/pgtable.h              |  7 -------
arch/arc/include/asm/pgtable-levels.h         | 11 ----------
arch/arm/include/asm/pgtable.h                |  7 -------
arch/arm/kernel/traps.c                       | 17 ----------------
arch/arm64/include/asm/pgtable.h              | 15 --------------
arch/csky/include/asm/pgtable.h               |  4 ----
arch/hexagon/include/asm/pgtable.h            |  3 ---
arch/loongarch/include/asm/pgtable.h          | 13 ------------
arch/loongarch/mm/init.c                      |  4 +++-
arch/m68k/include/asm/mcf_pgtable.h           |  6 ------
arch/m68k/include/asm/motorola_pgtable.h      |  8 --------
arch/m68k/include/asm/sun3_pgtable.h          |  7 -------
arch/microblaze/include/asm/pgtable.h         |  7 -------
arch/mips/include/asm/pgtable-32.h            | 10 ----------
arch/mips/include/asm/pgtable-64.h            | 13 ------------
arch/nios2/include/asm/pgtable.h              |  7 -------
arch/openrisc/include/asm/pgtable.h           |  7 -------
arch/parisc/include/asm/pgtable.h             |  9 ---------
arch/parisc/kernel/pci-dma.c                  |  6 ++----
arch/powerpc/include/asm/book3s/32/pgtable.h  |  2 --
arch/powerpc/include/asm/book3s/64/pgtable.h  |  7 -------
arch/powerpc/include/asm/nohash/32/pgtable.h  |  2 --
.../include/asm/nohash/64/pgtable-4k.h        |  3 ---
arch/powerpc/include/asm/nohash/64/pgtable.h  |  5 -----
arch/riscv/include/asm/page.h                 |  6 ------
arch/riscv/include/asm/pgtable-64.h           |  9 ---------
arch/riscv/include/asm/pgtable.h              |  4 ----
arch/s390/include/asm/pgtable.h               | 11 ----------
arch/sh/include/asm/pgtable-3level.h          |  3 ---
arch/sh/include/asm/pgtable_32.h              | 13 ------------
arch/sh/mm/init.c                             | 16 ++++++++-------
arch/sparc/include/asm/pgtable_32.h           |  3 ---
arch/sparc/include/asm/pgtable_64.h           | 10 ----------
arch/um/include/asm/pgtable-2level.h          |  7 -------
arch/um/include/asm/pgtable-4level.h          | 13 ------------
arch/x86/include/asm/pgtable-2level.h         |  5 -----
arch/x86/include/asm/pgtable-3level.h         | 11 ----------
arch/x86/include/asm/pgtable_64.h             | 18 -----------------
arch/xtensa/include/asm/pgtable.h             |  4 ----
include/asm-generic/pgtable-nop4d.h           |  1 -
include/asm-generic/pgtable-nopmd.h           |  1 -
include/asm-generic/pgtable-nopud.h           |  1 -
include/linux/pgtable.h                       | 14 +++++++++++++
mm/memory.c                                   | 15 +-------------
mm/pgtable-generic.c                          | 20 +++++++++++++++----
45 files changed, 45 insertions(+), 320 deletions(-)
[PATCH 0/8] mm: Drop pxd_ERROR()
Posted by Anshuman Khandual 3 weeks, 5 days ago
pxd_ERROR() macros have been provided by all platforms, which are very much
identical and can be dropped off completely if these pgtable printing could
be moved to callers in generic MM aka all pxd_clear_bad().

But first cleanups and re-organizations are required in some platforms that
are using these macros internally. Afterwards [pte|pmd|pud|p4d|pgd]_ERROR()
macros have been completely dropped from the entire tree.

This series is based on v7.3-rc1 after the following patch and has also been
built tested on multiple platforms.

Changes in V1:

- Moved ptval_to_str() and adjcent declarations inside <include/linux/pgtable.h>
- Fixed type s/ptrval_to_str/ptval_to_str in [PATCH 1/8]
- Dropped PTE_FMT from riscv platform
- Added all tags received

Changes in RFC V3:

https://lore.kernel.org/all/20260818040041.1891769-1-anshuman.khandual@arm.com/

- Moved ptrval_to_str() as header in a separate patch
- Stopped using pxd_ERROR() in generic MM in a separate patch
- Dropped pxd_ERRO() macros from all platforms in a separate patch
- Dropped print_bad_pte() and also cleaned up set_pte_phys()
- Added some pr_error() messages in __get_pte_phys()
- Cleaned up error messages and used ptrval_to_str() in platforms

Changes in RFC V2:

https://lore.kernel.org/all/20260811042119.3652929-1-anshuman.khandual@arm.com/

- Added clean up patches for platforms with existing pxd_ERROR() usage
- Dropped __FILE__ and __LINE__ from all print sections per David

Changes in RFC V1:

https://lore.kernel.org/all/20260806080639.1916749-1-anshuman.khandual@arm.com/

Cc: David Hildenbrand (Arm) <david@kernel.org>
Cc: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: WANG Xuerui <kernel@xen0n.name>
Cc: linux-alpha@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-csky@vger.kernel.org
Cc: linux-hexagon@vger.kernel.org
Cc: loongarch@lists.linux.dev
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-mips@vger.kernel.org
Cc: linux-openrisc@vger.kernel.org
Cc: linux-parisc@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-riscv@lists.infradead.org
Cc: linux-s390@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Cc: sparclinux@vger.kernel.org
Cc: linux-um@lists.infradead.org
Cc: linux-arch@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org

Anshuman Khandual (8):
  mm: Make ptval_to_str() generally available
  mm: Stop using pxd_ERROR()
  loongarch/mm: Stop using pte_ERROR()
  parisc/mm: Directly use generic [pmd|pgd]_clear_bad()
  sh/mm: Stop using pte_ERROR()
  sh/mm: Stop using [p4d|pud|pmd]_ERROR()
  sh/mm: Stop using pgd_ERROR()
  mm: Drop pxd_ERROR()

 arch/alpha/include/asm/pgtable.h              |  7 -------
 arch/arc/include/asm/pgtable-levels.h         | 11 ----------
 arch/arm/include/asm/pgtable.h                |  7 -------
 arch/arm/kernel/traps.c                       | 17 ----------------
 arch/arm64/include/asm/pgtable.h              | 15 --------------
 arch/csky/include/asm/pgtable.h               |  4 ----
 arch/hexagon/include/asm/pgtable.h            |  3 ---
 arch/loongarch/include/asm/pgtable.h          | 13 ------------
 arch/loongarch/mm/init.c                      |  4 +++-
 arch/m68k/include/asm/mcf_pgtable.h           |  6 ------
 arch/m68k/include/asm/motorola_pgtable.h      |  8 --------
 arch/m68k/include/asm/sun3_pgtable.h          |  7 -------
 arch/microblaze/include/asm/pgtable.h         |  7 -------
 arch/mips/include/asm/pgtable-32.h            | 10 ----------
 arch/mips/include/asm/pgtable-64.h            | 13 ------------
 arch/nios2/include/asm/pgtable.h              |  7 -------
 arch/openrisc/include/asm/pgtable.h           |  7 -------
 arch/parisc/include/asm/pgtable.h             |  9 ---------
 arch/parisc/kernel/pci-dma.c                  |  6 ++----
 arch/powerpc/include/asm/book3s/32/pgtable.h  |  2 --
 arch/powerpc/include/asm/book3s/64/pgtable.h  |  7 -------
 arch/powerpc/include/asm/nohash/32/pgtable.h  |  2 --
 .../include/asm/nohash/64/pgtable-4k.h        |  3 ---
 arch/powerpc/include/asm/nohash/64/pgtable.h  |  5 -----
 arch/riscv/include/asm/page.h                 |  6 ------
 arch/riscv/include/asm/pgtable-64.h           |  9 ---------
 arch/riscv/include/asm/pgtable.h              |  4 ----
 arch/s390/include/asm/pgtable.h               | 11 ----------
 arch/sh/include/asm/pgtable-3level.h          |  3 ---
 arch/sh/include/asm/pgtable_32.h              | 13 ------------
 arch/sh/mm/init.c                             | 16 ++++++++-------
 arch/sparc/include/asm/pgtable_32.h           |  3 ---
 arch/sparc/include/asm/pgtable_64.h           | 10 ----------
 arch/um/include/asm/pgtable-2level.h          |  7 -------
 arch/um/include/asm/pgtable-4level.h          | 13 ------------
 arch/x86/include/asm/pgtable-2level.h         |  5 -----
 arch/x86/include/asm/pgtable-3level.h         | 11 ----------
 arch/x86/include/asm/pgtable_64.h             | 18 -----------------
 arch/xtensa/include/asm/pgtable.h             |  4 ----
 include/asm-generic/pgtable-nop4d.h           |  1 -
 include/asm-generic/pgtable-nopmd.h           |  1 -
 include/asm-generic/pgtable-nopud.h           |  1 -
 include/linux/pgtable.h                       | 14 +++++++++++++
 mm/memory.c                                   | 15 +-------------
 mm/pgtable-generic.c                          | 20 +++++++++++++++----
 45 files changed, 45 insertions(+), 320 deletions(-)

-- 
2.43.0
Re: [PATCH 0/8] mm: Drop pxd_ERROR()
Posted by John Paul Adrian Glaubitz 3 weeks, 5 days ago
Hi Anshuman,

On Mon, 2026-08-31 at 11:13 +0530, Anshuman Khandual wrote:
> pxd_ERROR() macros have been provided by all platforms, which are very much
> identical and can be dropped off completely if these pgtable printing could
> be moved to callers in generic MM aka all pxd_clear_bad().

If pxd_ERROR() macros are really all identical, why not provide a common definiton
of that macro? I'm always a bit concerned about such changes as there is always
a risk to oversee arch-specific peculiarities.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
Re: [PATCH 0/8] mm: Drop pxd_ERROR()
Posted by Anshuman Khandual 3 weeks, 5 days ago

On 31/08/26 11:38 AM, John Paul Adrian Glaubitz wrote:
> Hi Anshuman,
> 
> On Mon, 2026-08-31 at 11:13 +0530, Anshuman Khandual wrote:
>> pxd_ERROR() macros have been provided by all platforms, which are very much
>> identical and can be dropped off completely if these pgtable printing could
>> be moved to callers in generic MM aka all pxd_clear_bad().
> 
> If pxd_ERROR() macros are really all identical, why not provide a common definiton
> of that macro? I'm always a bit concerned about such changes as there is always
> a risk to oversee arch-specific peculiarities.

We don't those platform macros any more after converting generic MM into using ptval_bytes_to_hex_str()
which now handles different pgtable entry types.
> 
> Adrian
>
Re: [PATCH 0/8] mm: Drop pxd_ERROR()
Posted by Andrew Morton 3 weeks, 4 days ago
On Mon, 31 Aug 2026 11:13:22 +0530 Anshuman Khandual <anshuman.khandual@arm.com> wrote:

> pxd_ERROR() macros have been provided by all platforms, which are very much
> identical and can be dropped off completely if these pgtable printing could
> be moved to callers in generic MM aka all pxd_clear_bad().
> 
> But first cleanups and re-organizations are required in some platforms that
> are using these macros internally. Afterwards [pte|pmd|pud|p4d|pgd]_ERROR()
> macros have been completely dropped from the entire tree.

All was going nicely until...

> This series is based on v7.3-rc1 after the following patch and has also been
> built tested on multiple platforms.

*what* following patch???

Oh well, I'll queue it all up and shall hope for the arch maintainer
acks to roll in.  Please.
Re: [PATCH 0/8] mm: Drop pxd_ERROR()
Posted by Anshuman Khandual 3 weeks, 4 days ago
On Mon, Aug 31, 2026 at 06:55:19PM -0700, Andrew Morton wrote:
> On Mon, 31 Aug 2026 11:13:22 +0530 Anshuman Khandual <anshuman.khandual@arm.com> wrote:
> 
> > pxd_ERROR() macros have been provided by all platforms, which are very much
> > identical and can be dropped off completely if these pgtable printing could
> > be moved to callers in generic MM aka all pxd_clear_bad().
> > 
> > But first cleanups and re-organizations are required in some platforms that
> > are using these macros internally. Afterwards [pte|pmd|pud|p4d|pgd]_ERROR()
> > macros have been completely dropped from the entire tree.
> 
> All was going nicely until...
> 
> > This series is based on v7.3-rc1 after the following patch and has also been
> > built tested on multiple platforms.
> 
> *what* following patch???

The dependency patch has already been merged upstream.

092836fedd82 (mm: standardize printing for pgtable entries)

Please ignore this.

> 
> Oh well, I'll queue it all up and shall hope for the arch maintainer
> acks to roll in.  Please.

Thanks !