All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Uros Bizjak <ubizjak@gmail.com>
Cc: x86@kernel.org, llvm@lists.linux.dev,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>
Subject: Re: [PATCH 1/2] x86/percpu: Fix "multiple identical address spaces specified for type" clang warning
Date: Wed, 17 Jul 2024 16:40:32 +0200	[thread overview]
Message-ID: <ZpfX4KelYaXsHlHe@gmail.com> (raw)
In-Reply-To: <20240526175655.227798-1-ubizjak@gmail.com>


* Uros Bizjak <ubizjak@gmail.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@gmail.com>
> 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: Nathan Chancellor <nathan@kernel.org>
> 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));			\
> +})

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?

Thanks,

	Ingo

  parent reply	other threads:[~2024-07-17 14:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-26 17:55 [PATCH 1/2] x86/percpu: Fix "multiple identical address spaces specified for type" clang warning Uros Bizjak
2024-05-26 17:55 ` [PATCH 2/2] x86/percpu: *DO NOT MERGE* Enable named address spaces for clang Uros Bizjak
2024-05-30 15:57 ` [PATCH 1/2] x86/percpu: Fix "multiple identical address spaces specified for type" clang warning Nathan Chancellor
2024-07-17 14:40 ` Ingo Molnar [this message]
2024-07-17 15:53   ` Uros Bizjak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZpfX4KelYaXsHlHe@gmail.com \
    --to=mingo@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=justinstitt@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=tglx@linutronix.de \
    --cc=ubizjak@gmail.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.