* [PATCH v2] asm-generic: fix variable 'p4d' set but not used
@ 2019-08-06 23:29 Qian Cai
2019-08-07 7:30 ` Arnd Bergmann
2019-08-15 17:38 ` Guenter Roeck
0 siblings, 2 replies; 3+ messages in thread
From: Qian Cai @ 2019-08-06 23:29 UTC (permalink / raw)
To: akpm
Cc: arnd, kirill.shutemov, mhocko, jgg, linux-mm, linux-arch,
linux-kernel, Qian Cai
A compiler throws a warning on an arm64 system since the
commit 9849a5697d3d ("arch, mm: convert all architectures to use
5level-fixup.h"),
mm/kasan/init.c: In function 'kasan_free_p4d':
mm/kasan/init.c:344:9: warning: variable 'p4d' set but not used
[-Wunused-but-set-variable]
p4d_t *p4d;
^~~
because p4d_none() in "5level-fixup.h" is compiled away while it is a
static inline function in "pgtable-nopud.h". However, if converted
p4d_none() to a static inline there, powerpc would be unhappy as it
reads those in assembler language in
"arch/powerpc/include/asm/book3s/64/pgtable.h", so it needs to skip
assembly include for the static inline C function. While at it,
converted a few similar functions to be consistent with the ones in
"pgtable-nopud.h".
Signed-off-by: Qian Cai <cai@lca.pw>
---
v2: Convert them to static inline functions.
include/asm-generic/5level-fixup.h | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/include/asm-generic/5level-fixup.h b/include/asm-generic/5level-fixup.h
index bb6cb347018c..f6947da70d71 100644
--- a/include/asm-generic/5level-fixup.h
+++ b/include/asm-generic/5level-fixup.h
@@ -19,9 +19,24 @@
#define p4d_alloc(mm, pgd, address) (pgd)
#define p4d_offset(pgd, start) (pgd)
-#define p4d_none(p4d) 0
-#define p4d_bad(p4d) 0
-#define p4d_present(p4d) 1
+
+#ifndef __ASSEMBLY__
+static inline int p4d_none(p4d_t p4d)
+{
+ return 0;
+}
+
+static inline int p4d_bad(p4d_t p4d)
+{
+ return 0;
+}
+
+static inline int p4d_present(p4d_t p4d)
+{
+ return 1;
+}
+#endif
+
#define p4d_ERROR(p4d) do { } while (0)
#define p4d_clear(p4d) pgd_clear(p4d)
#define p4d_val(p4d) pgd_val(p4d)
--
2.20.1 (Apple Git-117)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] asm-generic: fix variable 'p4d' set but not used
2019-08-06 23:29 [PATCH v2] asm-generic: fix variable 'p4d' set but not used Qian Cai
@ 2019-08-07 7:30 ` Arnd Bergmann
2019-08-15 17:38 ` Guenter Roeck
1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2019-08-07 7:30 UTC (permalink / raw)
To: Qian Cai
Cc: Andrew Morton, Kirill A . Shutemov, Michal Hocko,
Jason Gunthorpe, Linux-MM, linux-arch, Linux Kernel Mailing List
On Wed, Aug 7, 2019 at 1:29 AM Qian Cai <cai@lca.pw> wrote:
>
> A compiler throws a warning on an arm64 system since the
> commit 9849a5697d3d ("arch, mm: convert all architectures to use
> 5level-fixup.h"),
>
> mm/kasan/init.c: In function 'kasan_free_p4d':
> mm/kasan/init.c:344:9: warning: variable 'p4d' set but not used
> [-Wunused-but-set-variable]
> p4d_t *p4d;
> ^~~
>
> because p4d_none() in "5level-fixup.h" is compiled away while it is a
> static inline function in "pgtable-nopud.h". However, if converted
> p4d_none() to a static inline there, powerpc would be unhappy as it
> reads those in assembler language in
> "arch/powerpc/include/asm/book3s/64/pgtable.h", so it needs to skip
> assembly include for the static inline C function. While at it,
> converted a few similar functions to be consistent with the ones in
> "pgtable-nopud.h".
>
> Signed-off-by: Qian Cai <cai@lca.pw>
Acked-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] asm-generic: fix variable 'p4d' set but not used
2019-08-06 23:29 [PATCH v2] asm-generic: fix variable 'p4d' set but not used Qian Cai
2019-08-07 7:30 ` Arnd Bergmann
@ 2019-08-15 17:38 ` Guenter Roeck
1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2019-08-15 17:38 UTC (permalink / raw)
To: Qian Cai
Cc: akpm, arnd, kirill.shutemov, mhocko, jgg, linux-mm, linux-arch,
linux-kernel, Linus Torvalds
On Tue, Aug 06, 2019 at 07:29:17PM -0400, Qian Cai wrote:
> A compiler throws a warning on an arm64 system since the
> commit 9849a5697d3d ("arch, mm: convert all architectures to use
> 5level-fixup.h"),
>
> mm/kasan/init.c: In function 'kasan_free_p4d':
> mm/kasan/init.c:344:9: warning: variable 'p4d' set but not used
> [-Wunused-but-set-variable]
> p4d_t *p4d;
> ^~~
>
> because p4d_none() in "5level-fixup.h" is compiled away while it is a
> static inline function in "pgtable-nopud.h". However, if converted
> p4d_none() to a static inline there, powerpc would be unhappy as it
> reads those in assembler language in
> "arch/powerpc/include/asm/book3s/64/pgtable.h", so it needs to skip
> assembly include for the static inline C function. While at it,
> converted a few similar functions to be consistent with the ones in
> "pgtable-nopud.h".
>
> Signed-off-by: Qian Cai <cai@lca.pw>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
All parisc builds fail with this patch applied.
include/asm-generic/5level-fixup.h:14:18: error:
unknown type name 'pgd_t'; did you mean 'pid_t'?
Bisect results below.
Guenter
---
# bad: [329120423947e8b36fd2f8b5cf69944405d0aece] Merge tag 'auxdisplay-for-linus-v5.3-rc5' of git://github.com/ojeda/linux
# good: [ee1c7bd33e66376067fd6306b730789ee2ae53e4] Merge tag 'tpmdd-next-20190813' of git://git.infradead.org/users/jjs/linux-tpmdd
git bisect start 'HEAD' 'ee1c7bd33e66'
# bad: [e83b009c5c366b678c7986fa6c1d38fed06c954c] Merge tag 'dma-mapping-5.3-4' of git://git.infradead.org/users/hch/dma-mapping
git bisect bad e83b009c5c366b678c7986fa6c1d38fed06c954c
# bad: [92717d429b38e4f9f934eed7e605cc42858f1839] Revert "Revert "mm, thp: consolidate THP gfp handling into alloc_hugepage_direct_gfpmask""
git bisect bad 92717d429b38e4f9f934eed7e605cc42858f1839
# good: [b997052bc3ac444a0bceab1093aff7ae71ed419e] mm/z3fold.c: fix z3fold_destroy_pool() race condition
git bisect good b997052bc3ac444a0bceab1093aff7ae71ed419e
# good: [951531691c4bcaa59f56a316e018bc2ff1ddf855] mm/usercopy: use memory range to be accessed for wraparound check
git bisect good 951531691c4bcaa59f56a316e018bc2ff1ddf855
# good: [6a2aeab59e97101b4001bac84388fc49a992f87e] seq_file: fix problem when seeking mid-record
git bisect good 6a2aeab59e97101b4001bac84388fc49a992f87e
# bad: [0cfaee2af3a04c0be5f056cebe5f804dedc59a43] include/asm-generic/5level-fixup.h: fix variable 'p4d' set but not used
git bisect bad 0cfaee2af3a04c0be5f056cebe5f804dedc59a43
# first bad commit: [0cfaee2af3a04c0be5f056cebe5f804dedc59a43] include/asm-generic/5level-fixup.h: fix variable 'p4d' set but not used
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-08-15 17:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-06 23:29 [PATCH v2] asm-generic: fix variable 'p4d' set but not used Qian Cai
2019-08-07 7:30 ` Arnd Bergmann
2019-08-15 17:38 ` Guenter Roeck
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).