linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Remove pud_user() from asm-generic/pgtable-nopmd.h
@ 2025-08-12 11:14 Christophe Leroy
  2025-08-12 11:31 ` Alexandre Ghiti
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christophe Leroy @ 2025-08-12 11:14 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Arnd Bergmann
  Cc: Christophe Leroy, linux-arm-kernel, linux-kernel, linux-riscv,
	linux-arch, Peter Xu, Oscar Salvador

Commit 2c8a81dc0cc5 ("riscv/mm: fix two page table check related
issues") added pud_user() in include/asm-generic/pgtable-nopmd.h

But pud_user() only exists on ARM64 and RISCV and is not expected
by any part of MM.

Add the missing definition in arch/riscv/include/asm/pgtable-32.h
and remove it from asm-generic/pgtable-nopmd.h

A stub pud_user() is also required for ARM64 after
commit ed928a3402d8 ("arm64/mm: fix page table check compile
error for CONFIG_PGTABLE_LEVELS=2")

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
---
 arch/arm64/include/asm/pgtable.h    | 1 +
 arch/riscv/include/asm/pgtable-32.h | 5 +++++
 include/asm-generic/pgtable-nopmd.h | 1 -
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index abd2dee416b3b..fef7cc7a340d8 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -955,6 +955,7 @@ static inline pmd_t *pud_pgtable(pud_t pud)
 
 #define pud_valid(pud)		false
 #define pud_page_paddr(pud)	({ BUILD_BUG(); 0; })
+#define pud_user		false /* Always 0 with folding */
 #define pud_user_exec(pud)	pud_user(pud) /* Always 0 with folding */
 
 /* Match pmd_offset folding in <asm/generic/pgtable-nopmd.h> */
diff --git a/arch/riscv/include/asm/pgtable-32.h b/arch/riscv/include/asm/pgtable-32.h
index 00f3369570a83..37878ef374668 100644
--- a/arch/riscv/include/asm/pgtable-32.h
+++ b/arch/riscv/include/asm/pgtable-32.h
@@ -36,4 +36,9 @@
 static const __maybe_unused int pgtable_l4_enabled;
 static const __maybe_unused int pgtable_l5_enabled;
 
+static inline int pud_user(pud_t pud)
+{
+	return 0;
+}
+
 #endif /* _ASM_RISCV_PGTABLE_32_H */
diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
index 8ffd64e7a24cb..b01349a312fa7 100644
--- a/include/asm-generic/pgtable-nopmd.h
+++ b/include/asm-generic/pgtable-nopmd.h
@@ -30,7 +30,6 @@ typedef struct { pud_t pud; } pmd_t;
 static inline int pud_none(pud_t pud)		{ return 0; }
 static inline int pud_bad(pud_t pud)		{ return 0; }
 static inline int pud_present(pud_t pud)	{ return 1; }
-static inline int pud_user(pud_t pud)		{ return 0; }
 static inline int pud_leaf(pud_t pud)		{ return 0; }
 static inline void pud_clear(pud_t *pud)	{ }
 #define pmd_ERROR(pmd)				(pud_ERROR((pmd).pud))
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: Remove pud_user() from asm-generic/pgtable-nopmd.h
  2025-08-12 11:14 [PATCH] mm: Remove pud_user() from asm-generic/pgtable-nopmd.h Christophe Leroy
@ 2025-08-12 11:31 ` Alexandre Ghiti
  2025-08-12 16:29 ` Catalin Marinas
  2025-08-13  6:56 ` kernel test robot
  2 siblings, 0 replies; 4+ messages in thread
From: Alexandre Ghiti @ 2025-08-12 11:31 UTC (permalink / raw)
  To: Christophe Leroy, Catalin Marinas, Will Deacon, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Arnd Bergmann
  Cc: linux-arm-kernel, linux-kernel, linux-riscv, linux-arch, Peter Xu,
	Oscar Salvador

Hi Christophe,

On 8/12/25 13:14, Christophe Leroy wrote:
> Commit 2c8a81dc0cc5 ("riscv/mm: fix two page table check related
> issues") added pud_user() in include/asm-generic/pgtable-nopmd.h
>
> But pud_user() only exists on ARM64 and RISCV and is not expected
> by any part of MM.
>
> Add the missing definition in arch/riscv/include/asm/pgtable-32.h
> and remove it from asm-generic/pgtable-nopmd.h
>
> A stub pud_user() is also required for ARM64 after
> commit ed928a3402d8 ("arm64/mm: fix page table check compile
> error for CONFIG_PGTABLE_LEVELS=2")
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Reviewed-by: Peter Xu <peterx@redhat.com>
> Reviewed-by: Oscar Salvador <osalvador@suse.de>
> ---
>   arch/arm64/include/asm/pgtable.h    | 1 +
>   arch/riscv/include/asm/pgtable-32.h | 5 +++++
>   include/asm-generic/pgtable-nopmd.h | 1 -
>   3 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index abd2dee416b3b..fef7cc7a340d8 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -955,6 +955,7 @@ static inline pmd_t *pud_pgtable(pud_t pud)
>   
>   #define pud_valid(pud)		false
>   #define pud_page_paddr(pud)	({ BUILD_BUG(); 0; })
> +#define pud_user		false /* Always 0 with folding */
>   #define pud_user_exec(pud)	pud_user(pud) /* Always 0 with folding */
>   
>   /* Match pmd_offset folding in <asm/generic/pgtable-nopmd.h> */
> diff --git a/arch/riscv/include/asm/pgtable-32.h b/arch/riscv/include/asm/pgtable-32.h
> index 00f3369570a83..37878ef374668 100644
> --- a/arch/riscv/include/asm/pgtable-32.h
> +++ b/arch/riscv/include/asm/pgtable-32.h
> @@ -36,4 +36,9 @@
>   static const __maybe_unused int pgtable_l4_enabled;
>   static const __maybe_unused int pgtable_l5_enabled;
>   
> +static inline int pud_user(pud_t pud)
> +{
> +	return 0;
> +}
> +
>   #endif /* _ASM_RISCV_PGTABLE_32_H */
> diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
> index 8ffd64e7a24cb..b01349a312fa7 100644
> --- a/include/asm-generic/pgtable-nopmd.h
> +++ b/include/asm-generic/pgtable-nopmd.h
> @@ -30,7 +30,6 @@ typedef struct { pud_t pud; } pmd_t;
>   static inline int pud_none(pud_t pud)		{ return 0; }
>   static inline int pud_bad(pud_t pud)		{ return 0; }
>   static inline int pud_present(pud_t pud)	{ return 1; }
> -static inline int pud_user(pud_t pud)		{ return 0; }
>   static inline int pud_leaf(pud_t pud)		{ return 0; }
>   static inline void pud_clear(pud_t *pud)	{ }
>   #define pmd_ERROR(pmd)				(pud_ERROR((pmd).pud))


Acked-by: Alexandre Ghiti <alexghiti@rivosinc.com> # riscv

Thanks,

Alex


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: Remove pud_user() from asm-generic/pgtable-nopmd.h
  2025-08-12 11:14 [PATCH] mm: Remove pud_user() from asm-generic/pgtable-nopmd.h Christophe Leroy
  2025-08-12 11:31 ` Alexandre Ghiti
@ 2025-08-12 16:29 ` Catalin Marinas
  2025-08-13  6:56 ` kernel test robot
  2 siblings, 0 replies; 4+ messages in thread
From: Catalin Marinas @ 2025-08-12 16:29 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Will Deacon, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, Arnd Bergmann, linux-arm-kernel, linux-kernel,
	linux-riscv, linux-arch, Peter Xu, Oscar Salvador

On Tue, Aug 12, 2025 at 01:14:19PM +0200, Christophe Leroy wrote:
> Commit 2c8a81dc0cc5 ("riscv/mm: fix two page table check related
> issues") added pud_user() in include/asm-generic/pgtable-nopmd.h
> 
> But pud_user() only exists on ARM64 and RISCV and is not expected
> by any part of MM.
> 
> Add the missing definition in arch/riscv/include/asm/pgtable-32.h
> and remove it from asm-generic/pgtable-nopmd.h
> 
> A stub pud_user() is also required for ARM64 after
> commit ed928a3402d8 ("arm64/mm: fix page table check compile
> error for CONFIG_PGTABLE_LEVELS=2")
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Reviewed-by: Peter Xu <peterx@redhat.com>
> Reviewed-by: Oscar Salvador <osalvador@suse.de>
> ---
>  arch/arm64/include/asm/pgtable.h    | 1 +
>  arch/riscv/include/asm/pgtable-32.h | 5 +++++
>  include/asm-generic/pgtable-nopmd.h | 1 -
>  3 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index abd2dee416b3b..fef7cc7a340d8 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -955,6 +955,7 @@ static inline pmd_t *pud_pgtable(pud_t pud)
>  
>  #define pud_valid(pud)		false
>  #define pud_page_paddr(pud)	({ BUILD_BUG(); 0; })
> +#define pud_user		false /* Always 0 with folding */

Doesn't pud_user take an argument? With that fixed:

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

(strangely I couldn't get the build to fail without a pud_user
definition, even with the PGTABLE_LEVELS=2 and PAGE_TABLE_CHECK=y
configuration)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: Remove pud_user() from asm-generic/pgtable-nopmd.h
  2025-08-12 11:14 [PATCH] mm: Remove pud_user() from asm-generic/pgtable-nopmd.h Christophe Leroy
  2025-08-12 11:31 ` Alexandre Ghiti
  2025-08-12 16:29 ` Catalin Marinas
@ 2025-08-13  6:56 ` kernel test robot
  2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2025-08-13  6:56 UTC (permalink / raw)
  To: Christophe Leroy, Catalin Marinas, Will Deacon, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Arnd Bergmann
  Cc: oe-kbuild-all, Christophe Leroy, linux-arm-kernel, linux-kernel,
	linux-riscv, linux-arch, Peter Xu, Oscar Salvador

Hi Christophe,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-everything]

url:    https://github.com/intel-lab-lkp/linux/commits/Christophe-Leroy/mm-Remove-pud_user-from-asm-generic-pgtable-nopmd-h/20250812-195212
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link:    https://lore.kernel.org/r/c7f99612ecfa04054b37518df661d04f88f7c9af.1754997083.git.christophe.leroy%40csgroup.eu
patch subject: [PATCH] mm: Remove pud_user() from asm-generic/pgtable-nopmd.h
config: arm64-randconfig-002-20250813 (https://download.01.org/0day-ci/archive/20250813/202508131402.ZaPLdNsY-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 12.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250813/202508131402.ZaPLdNsY-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202508131402.ZaPLdNsY-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/linux/pgtable.h:6,
                    from arch/arm64/include/asm/io.h:12,
                    from include/linux/io.h:12,
                    from include/linux/irq.h:20,
                    from include/asm-generic/hardirq.h:17,
                    from arch/arm64/include/asm/hardirq.h:17,
                    from include/linux/hardirq.h:11,
                    from include/linux/interrupt.h:11,
                    from include/linux/trace_recursion.h:5,
                    from include/linux/ftrace.h:10,
                    from arch/arm64/kernel/asm-offsets.c:12:
   arch/arm64/include/asm/pgtable.h: In function 'pud_user_accessible_page':
>> arch/arm64/include/asm/pgtable.h:958:33: error: called object is not a function or function pointer
     958 | #define pud_user                false /* Always 0 with folding */
         |                                 ^~~~~
   arch/arm64/include/asm/pgtable.h:1307:54: note: in expansion of macro 'pud_user'
    1307 |         return pud_valid(pud) && !pud_table(pud) && (pud_user(pud) || pud_user_exec(pud));
         |                                                      ^~~~~~~~
>> arch/arm64/include/asm/pgtable.h:958:33: error: called object is not a function or function pointer
     958 | #define pud_user                false /* Always 0 with folding */
         |                                 ^~~~~
   arch/arm64/include/asm/pgtable.h:959:33: note: in expansion of macro 'pud_user'
     959 | #define pud_user_exec(pud)      pud_user(pud) /* Always 0 with folding */
         |                                 ^~~~~~~~
   arch/arm64/include/asm/pgtable.h:1307:71: note: in expansion of macro 'pud_user_exec'
    1307 |         return pud_valid(pud) && !pud_table(pud) && (pud_user(pud) || pud_user_exec(pud));
         |                                                                       ^~~~~~~~~~~~~
   make[3]: *** [scripts/Makefile.build:182: arch/arm64/kernel/asm-offsets.s] Error 1 shuffle=3093671401
   make[3]: Target 'prepare' not remade because of errors.
   make[2]: *** [Makefile:1281: prepare0] Error 2 shuffle=3093671401
   make[2]: Target 'prepare' not remade because of errors.
   make[1]: *** [Makefile:248: __sub-make] Error 2 shuffle=3093671401
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [Makefile:248: __sub-make] Error 2 shuffle=3093671401
   make: Target 'prepare' not remade because of errors.


vim +958 arch/arm64/include/asm/pgtable.h

   955	
   956	#define pud_valid(pud)		false
   957	#define pud_page_paddr(pud)	({ BUILD_BUG(); 0; })
 > 958	#define pud_user		false /* Always 0 with folding */
   959	#define pud_user_exec(pud)	pud_user(pud) /* Always 0 with folding */
   960	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-13  6:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-12 11:14 [PATCH] mm: Remove pud_user() from asm-generic/pgtable-nopmd.h Christophe Leroy
2025-08-12 11:31 ` Alexandre Ghiti
2025-08-12 16:29 ` Catalin Marinas
2025-08-13  6:56 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).