From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 362CA4681 for ; Wed, 13 Jul 2022 16:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=QbdkBLup6jXB8yWubblicxIBOf4zsK4ibRKurIlBFxo=; b=giW4MC/bMYism0l+yLNjTWxR6i 8lH3HQ0qJY3/eKLtL3pGhjN76TZrPH3spK9Jsydgy9W+rPVxDQG3E7i6V5D8S8+ZhWuIZ87yYE1Pn xN1afL4O6kKj976ssx1amJZJ9ogrq6WMKKbpZer0TZJPc43cNI57wNaPDFErW8LGsnagJfQEp3uPP xNOIllnki+Zh5YutIY0tFN6fOA0l+P1yioL9TTDBAxiGfkBZc19r6r0KIlqpR1IqeFzPF36rJAhyh 2IKlWousBal7xTHnIZIdjIiKnHJuecQJuZ9tOGoJxwGkoHkfjdsRUZZFJaGIMXDbagk18JRGrzjWH mPQ2IY/A==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBf8N-008OIL-GX; Wed, 13 Jul 2022 16:22:43 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 66E67300110; Wed, 13 Jul 2022 18:22:41 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 43AEF2013A006; Wed, 13 Jul 2022 18:22:41 +0200 (CEST) Date: Wed, 13 Jul 2022 18:22:41 +0200 From: Peter Zijlstra To: Nathan Chancellor Cc: Linus Torvalds , x86@kernel.org, Nick Desaulniers , Josh Poimboeuf , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, stable@vger.kernel.org, kernel test robot Subject: Re: [PATCH v2] x86/speculation: Use DECLARE_PER_CPU for x86_spec_ctrl_current Message-ID: References: <20220713152436.2294819-1-nathan@kernel.org> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220713152436.2294819-1-nathan@kernel.org> On Wed, Jul 13, 2022 at 08:24:37AM -0700, Nathan Chancellor wrote: > Clang warns: > > arch/x86/kernel/cpu/bugs.c:58:21: error: section attribute is specified on redeclared variable [-Werror,-Wsection] > DEFINE_PER_CPU(u64, x86_spec_ctrl_current); > ^ > arch/x86/include/asm/nospec-branch.h:283:12: note: previous declaration is here > extern u64 x86_spec_ctrl_current; > ^ > 1 error generated. > > The declaration should be using DECLARE_PER_CPU instead so all > attributes stay in sync. > > Cc: stable@vger.kernel.org > Fixes: fc02735b14ff ("KVM: VMX: Prevent guest RSB poisoning attacks with eIBRS") > Reported-by: kernel test robot > Signed-off-by: Nathan Chancellor > --- > > v1 -> v2: https://lore.kernel.org/20220713152222.1697913-1-nathan@kernel.org/ > > * Use asm/percpu.h instead of linux/percpu.h to avoid static call > include errors. > > arch/x86/include/asm/nospec-branch.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h > index bb05ed4f46bd..10a3bfc1eb23 100644 > --- a/arch/x86/include/asm/nospec-branch.h > +++ b/arch/x86/include/asm/nospec-branch.h > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > > #define RETPOLINE_THUNK_SIZE 32 > When I tried this earlier today I ran into cyclic headers, you sure this works?