Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1394649lqb; Thu, 30 May 2024 08:58:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWlpQ16C7codgC57ct8xYIwcVoCllwGpbxDY0umS74zVcB2Qe4m9uwUC4EMrW99cP6FQ8bSFdNfnQ1ktV7MUbZbSDAqsLDS7iDZJo8vuA== X-Google-Smtp-Source: AGHT+IFYv8R6EPClu8CHqqv4j5oqagyKqXn3YbGFcDGCWwLpPl9KXka0b6WZ8exLqMKaxn8qQB9F X-Received: by 2002:a05:6830:1551:b0:6eb:86c4:eeb5 with SMTP id 46e09a7af769-6f90af10505mr2850784a34.23.1717084688260; Thu, 30 May 2024 08:58:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717084688; cv=pass; d=google.com; s=arc-20160816; b=HtEq1ZbPbTgnBVCSL5fOzMKbQJOvZ9HZJcdIPZAcWlCCc4+rpe0cRBixLrR73fNzwr NhllJD+G+u/vR3qtzu051S/mwTc3EZBywUaTFF2LUIG4xMcms48G5uO/Zram/ps3wd5e G4fiBufDMQpK0gcGqQ6pOZfUyUcKq/9TPLzsKD5fBezNr1QxeIoM4tw74Scz81hIPc/p Rre5VuyeUkkinacCimyGKytzupjTph4++86gWWSgj3A3c5CH13PJPj+mLPlIan4Hxvu8 MfpsfiildtyL9JmAGP1pVikUMEFTim4VYsEwS9OwNGcgcA79oO5ZrhAHTtsOjLJyUER6 MwBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ptnaHQYJYu+R61+sXW0wjnRfx8sgs4tf1XsXz5M5Hsc=; fh=cK72mz3F/E+YffYjzX7ok2kp6rkdmLzrsA0o7tN65JU=; b=p85Ik9hyXX9+EgiDNR4rF+lgTv3X00vUF43FkxqkzDLdWHYGHf9dVYlb7L1VPeX8pE yxTenb1bua2GzFJj+eZnvdDThDj+clogmfqBR9qG8+GCvK5fDU7P25zDSKOyhWeDR9Et LzqqQPKA3KAUnikVCdl0qS9B+LtpCQJubVpZx0ZCxNjGCOUcUcHoWlOKfbIAa+80GEk/ dhumpe9RsJNVTJQ71qkjG/lPVYc+Bj2dxqrW8mZRs7CZ9d9lO6xCHECzgYimKgf9N2JX YnCvMaTuSWUXximNq8/Fo4pHtiWcCDs5BoUMC82AQ2ZHmf3bWDoERNjXd3c3o3HVQZjQ aqCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rhEtFDh2; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-195628-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195628-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43fb18c9ed6si153535441cf.661.2024.05.30.08.58.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 08:58:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195628-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rhEtFDh2; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-195628-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195628-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C8B971C233B2 for ; Thu, 30 May 2024 15:58:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6CCF1208A0; Thu, 30 May 2024 15:58:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rhEtFDh2" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 932F21F94C; Thu, 30 May 2024 15:58:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717084681; cv=none; b=WvgiVl6hVStlpqbp11eZhDbOcCQc3xiS+TJ4lDxlejSfUWOKU3oh4rjqu2HQTZhRcRbOdcQcJKf7JJag40P3DHa9LcDAghDWVDEXXeeynip7bjkEzw/j9McuFqfGDqQqiitEMNsR+MQXxocmpGC6zLDRy+3VGeffGs0H6s6Jt+k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717084681; c=relaxed/simple; bh=zY+OVKzxA8PmRaPqqnlec7h81ltBTYbGpiadV8zvQj8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UioB8apVF7SdmDT4nmEi6v3E2Bz9sEKy1LJr8md19PoLBoKdq7V7cuKt9EvxEA8lS9zivZPvQa9SIRWlOKLmIhv8OhLIKHmeNGaEwS+eatHSHiARhQJbpr5BpQi0tybTs5A7xve5cYYwy/2qL8lcWsltOV+VRtxqnQdpD8PTX2c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rhEtFDh2; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EA5CC2BBFC; Thu, 30 May 2024 15:58:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717084681; bh=zY+OVKzxA8PmRaPqqnlec7h81ltBTYbGpiadV8zvQj8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rhEtFDh2W2hBa/sIc0sOJKfsT/bjJECDFzQBlHUnbAgiTh4vxph9YXTIevp8SQ5uX afD4YYijCKbHRIGarKwVAVRrU5g46XKwVrENs5Zhawf6YVNTKRl97HfFYzfjsJIzrK dbRPPx8k0T5duEaxSWd58qkLLEtFDhi/mEER924buDMRT5fzqvuM2T5t30Sn+1EL69 bhj4MT0cBObDeyhqU5YEr1kNoAy/H/Kio0/invkh/G0mdjoDVo2g+xj3Z89Qi50clQ wkLLrHi8Aiac/UOZ4nwBhFh6XDR05Pv6IsUc8esSk0q+5pS2q/fODowAOpC/1pLD5T 7w9nNcM2oQjpw== Date: Thu, 30 May 2024 08:57:58 -0700 From: Nathan Chancellor To: Uros Bizjak Cc: x86@kernel.org, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Nick Desaulniers , Bill Wendling , Justin Stitt Subject: Re: [PATCH 1/2] x86/percpu: Fix "multiple identical address spaces specified for type" clang warning Message-ID: <20240530155758.GA2974773@thelio-3990X> References: <20240526175655.227798-1-ubizjak@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240526175655.227798-1-ubizjak@gmail.com> On Sun, May 26, 2024 at 07:55:52PM +0200, Uros Bizjak 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 Thanks, this resolves the warning for me when patch 2 is applied. Acked-by: Nathan Chancellor However, as both of us have noticed [1][2], there is a problem in LLVM's x86 backend with the address space casting that the kernel does, so patch 2 should not be merged. [1]: https://github.com/ClangBuiltLinux/linux/issues/2013 [2]: https://github.com/llvm/llvm-project/issues/93449 > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: Dave Hansen > Cc: "H. Peter Anvin" > Cc: Nathan Chancellor > Cc: Nick Desaulniers > Cc: Bill Wendling > Cc: Justin Stitt > --- > 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.42.0 >