[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFULd4YyoVvM3BnF8Ln3XD-kacavERjMCpw=1hXwCACvTPF1gg@mail.gmail.com>
Date: Wed, 17 Jul 2024 17:53:44 +0200
From: Uros Bizjak <ubizjak@...il.com>
To: Ingo Molnar <mingo@...nel.org>
Cc: x86@...nel.org, llvm@...ts.linux.dev, linux-kernel@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, "H. Peter Anvin" <hpa@...or.com>,
Nathan Chancellor <nathan@...nel.org>, Nick Desaulniers <ndesaulniers@...gle.com>,
Bill Wendling <morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>
Subject: Re: [PATCH 1/2] x86/percpu: Fix "multiple identical address spaces
specified for type" clang warning
On Wed, Jul 17, 2024 at 4:40 PM Ingo Molnar <mingo@...nel.org> wrote:
>
>
> * Uros Bizjak <ubizjak@...il.com> wrote:
>
> > 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@...il.com>
> > Cc: Thomas Gleixner <tglx@...utronix.de>
> > Cc: Ingo Molnar <mingo@...nel.org>
> > Cc: Borislav Petkov <bp@...en8.de>
> > Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> > Cc: "H. Peter Anvin" <hpa@...or.com>
> > Cc: Nathan Chancellor <nathan@...nel.org>
> > Cc: Nick Desaulniers <ndesaulniers@...gle.com>
> > Cc: Bill Wendling <morbo@...gle.com>
> > Cc: Justin Stitt <justinstitt@...gle.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)); \
> > +})
>
> So shouldn't this be carried together with the patch that enables named
> address spaces on Clang? Is it possible that this patch might not be needed
> in a Clang version where named address spaces work as expected?
No, as diagnosed by Clang, there are indeed two identical specifiers,
so the patch also applies as a general patch.
Regarding Clang, before enabling the feature, issue #93449 [1]
(internal compiler error) has to be fixed.
[1] https://github.com/llvm/llvm-project/issues/93449
Uros.
Powered by blists - more mailing lists