linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: ptdump: Fix build failure
@ 2021-04-15  9:31 Christophe Leroy
  2021-04-16  8:42 ` Steven Price
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe Leroy @ 2021-04-15  9:31 UTC (permalink / raw)
  To: Andrew Morton, Steven Price; +Cc: linux-mm, linuxppc-dev, linux-kernel

	  CC      mm/ptdump.o
	In file included from <command-line>:
	mm/ptdump.c: In function 'ptdump_pte_entry':
	././include/linux/compiler_types.h:320:38: error: call to '__compiletime_assert_207' declared with attribute error: Unsupported access size for {READ,WRITE}_ONCE().
	  320 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
	      |                                      ^
	././include/linux/compiler_types.h:301:4: note: in definition of macro '__compiletime_assert'
	  301 |    prefix ## suffix();    \
	      |    ^~~~~~
	././include/linux/compiler_types.h:320:2: note: in expansion of macro '_compiletime_assert'
	  320 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
	      |  ^~~~~~~~~~~~~~~~~~~
	./include/asm-generic/rwonce.h:36:2: note: in expansion of macro 'compiletime_assert'
	   36 |  compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
	      |  ^~~~~~~~~~~~~~~~~~
	./include/asm-generic/rwonce.h:49:2: note: in expansion of macro 'compiletime_assert_rwonce_type'
	   49 |  compiletime_assert_rwonce_type(x);    \
	      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	mm/ptdump.c:114:14: note: in expansion of macro 'READ_ONCE'
	  114 |  pte_t val = READ_ONCE(*pte);
	      |              ^~~~~~~~~
	make[2]: *** [mm/ptdump.o] Error 1

READ_ONCE() cannot be used for reading PTEs. Use ptep_get()
instead. See commit 481e980a7c19 ("mm: Allow arches to provide ptep_get()")
and commit c0e1c8c22beb ("powerpc/8xx: Provide ptep_get() with 16k pages")
for details.

Fixes: 30d621f6723b ("mm: add generic ptdump")
Cc: Steven Price <steven.price@arm.com>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 mm/ptdump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/ptdump.c b/mm/ptdump.c
index 4354c1422d57..da751448d0e4 100644
--- a/mm/ptdump.c
+++ b/mm/ptdump.c
@@ -111,7 +111,7 @@ static int ptdump_pte_entry(pte_t *pte, unsigned long addr,
 			    unsigned long next, struct mm_walk *walk)
 {
 	struct ptdump_state *st = walk->private;
-	pte_t val = READ_ONCE(*pte);
+	pte_t val = ptep_get(pte);
 
 	if (st->effective_prot)
 		st->effective_prot(st, 4, pte_val(val));
-- 
2.25.0


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

* Re: [PATCH] mm: ptdump: Fix build failure
  2021-04-15  9:31 [PATCH] mm: ptdump: Fix build failure Christophe Leroy
@ 2021-04-16  8:42 ` Steven Price
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Price @ 2021-04-16  8:42 UTC (permalink / raw)
  To: Christophe Leroy, Andrew Morton; +Cc: linux-mm, linuxppc-dev, linux-kernel

On 15/04/2021 10:31, Christophe Leroy wrote:
> 	  CC      mm/ptdump.o
> 	In file included from <command-line>:
> 	mm/ptdump.c: In function 'ptdump_pte_entry':
> 	././include/linux/compiler_types.h:320:38: error: call to '__compiletime_assert_207' declared with attribute error: Unsupported access size for {READ,WRITE}_ONCE().
> 	  320 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> 	      |                                      ^
> 	././include/linux/compiler_types.h:301:4: note: in definition of macro '__compiletime_assert'
> 	  301 |    prefix ## suffix();    \
> 	      |    ^~~~~~
> 	././include/linux/compiler_types.h:320:2: note: in expansion of macro '_compiletime_assert'
> 	  320 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> 	      |  ^~~~~~~~~~~~~~~~~~~
> 	./include/asm-generic/rwonce.h:36:2: note: in expansion of macro 'compiletime_assert'
> 	   36 |  compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
> 	      |  ^~~~~~~~~~~~~~~~~~
> 	./include/asm-generic/rwonce.h:49:2: note: in expansion of macro 'compiletime_assert_rwonce_type'
> 	   49 |  compiletime_assert_rwonce_type(x);    \
> 	      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 	mm/ptdump.c:114:14: note: in expansion of macro 'READ_ONCE'
> 	  114 |  pte_t val = READ_ONCE(*pte);
> 	      |              ^~~~~~~~~
> 	make[2]: *** [mm/ptdump.o] Error 1
> 
> READ_ONCE() cannot be used for reading PTEs. Use ptep_get()
> instead. See commit 481e980a7c19 ("mm: Allow arches to provide ptep_get()")
> and commit c0e1c8c22beb ("powerpc/8xx: Provide ptep_get() with 16k pages")
> for details.

It was cargo-culted from the arm64/x86 implementations (where this 
happens to be safe).

> Fixes: 30d621f6723b ("mm: add generic ptdump")
> Cc: Steven Price <steven.price@arm.com>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>

Reviewed-by: Steven Price <steven.price@arm.com>

Thanks,

Steve

> ---
>   mm/ptdump.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/ptdump.c b/mm/ptdump.c
> index 4354c1422d57..da751448d0e4 100644
> --- a/mm/ptdump.c
> +++ b/mm/ptdump.c
> @@ -111,7 +111,7 @@ static int ptdump_pte_entry(pte_t *pte, unsigned long addr,
>   			    unsigned long next, struct mm_walk *walk)
>   {
>   	struct ptdump_state *st = walk->private;
> -	pte_t val = READ_ONCE(*pte);
> +	pte_t val = ptep_get(pte);
>   
>   	if (st->effective_prot)
>   		st->effective_prot(st, 4, pte_val(val));
> 


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

end of thread, other threads:[~2021-04-16  8:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-15  9:31 [PATCH] mm: ptdump: Fix build failure Christophe Leroy
2021-04-16  8:42 ` Steven Price

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).