* [PATCH RESEND -tip] x86/percpu: Fix "multiple identical address spaces specified for type" clang warning
@ 2024-06-10 6:32 Uros Bizjak
0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2024-06-10 6:32 UTC (permalink / raw)
To: x86, linux-kernel
Cc: Uros Bizjak, Nathan Chancellor, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, H. Peter Anvin, Nick Desaulniers,
Bill Wendling, Justin Stitt
The clang build with named address spaces enabled currently fails with:
error: multiple identical address spaces specified for type [-Werror,-Wduplicate-decl-specifier]
The warning is emitted when accessing const_pcpu_hot structure,
which is already declared in __seg_gs named address space.
Use specialized accessor for __raw_cpu_read_const() instead, avoiding
redeclaring __seg_gs named address space via __raw_cpu_read().
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Acked-by: Nathan Chancellor <nathan@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Bill Wendling <morbo@google.com>
Cc: Justin Stitt <justinstitt@google.com>
---
arch/x86/include/asm/percpu.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
index c55a79d5feae..aeea5c8a17de 100644
--- a/arch/x86/include/asm/percpu.h
+++ b/arch/x86/include/asm/percpu.h
@@ -160,7 +160,10 @@ do { \
*(qual __my_cpu_type(pcp) *)__my_cpu_ptr(&(pcp)) = (val); \
} while (0)
-#define __raw_cpu_read_const(pcp) __raw_cpu_read(, , pcp)
+#define __raw_cpu_read_const(pcp) \
+({ \
+ *(typeof(pcp) *)(__force uintptr_t)(&(pcp)); \
+})
#else /* !CONFIG_USE_X86_SEG_SUPPORT: */
--
2.45.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-06-10 6:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-10 6:32 [PATCH RESEND -tip] x86/percpu: Fix "multiple identical address spaces specified for type" clang warning Uros Bizjak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox