Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp890108imw; Wed, 13 Jul 2022 09:47:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1stXORfviD8DCippGa01uM7mDKANviT0SyNHfe16l7RqvHRhogtN6NdC2lgcRemzbRCeuEx X-Received: by 2002:a17:902:eaca:b0:16b:dbde:130d with SMTP id p10-20020a170902eaca00b0016bdbde130dmr3876549pld.48.1657730844814; Wed, 13 Jul 2022 09:47:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657730844; cv=none; d=google.com; s=arc-20160816; b=jVUxtGPMHE4Jo0K502t1dJKKs8o9498ZqSa8foC1Ao6zU3XiNg0cXRpt1KbNL8FJBI CLHNgtTvsDlGf1AtkPUdtUxG2aWhgfNaDvJK1gJetIK41iqre7gVzgzqhkcDugVxfwhx xYnUX+pKBzGkwLjx7VilkuY9a13TJl4DC3+jwb4e5CqH3ee5O3Yog1Qn6UC/+eN4VKzL RppDowK2UAfFH/+Xx5o6tTuGmqiR6ySJXiXhep1QRRwqY9AuXdM94WDxATn89V7oM7PG k+jlVvx9Lgtsy2K4UJ8kipmoL2TVesKtRHoi2/ngPrZ/H15uTNu6nb1sJSs67+lkUSbC H+aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QbdkBLup6jXB8yWubblicxIBOf4zsK4ibRKurIlBFxo=; b=P73frqdU8w6aEzSNx8yNjm31FggNUAU5H9uc9w9enkk77HRypO6q8Kc3LgCbkEO50E BJnpHpxtHjIUzNxWQ4XwGP20ZC068cF7kYWFSMfdEsUsYm/+BSYkLF9wa9M2GH2Qq+1Z gLU/hqOV76eSf3dlh2SgXHMQKIe+Yv3ChFfBA8gJZPTOXZHGAuAgr75Rb8QDxVd0o+Eh BgJEHTbCxCUuaEwH9oDLT+1H0qQznZlGMf/9HBxVoipBj93TfO+F+Q28FznQsf39ZpLw l42TpgmMWP8Xd1hGUEJJvQLvQgDHsTr70Q9FlO/gBa0NjszT3LExQuqa8A1hUSEuOAS/ F+qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="giW4MC/b"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y7-20020a17090a86c700b001f068e76032si2716733pjv.171.2022.07.13.09.47.13; Wed, 13 Jul 2022 09:47:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="giW4MC/b"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236851AbiGMQXI (ORCPT + 99 others); Wed, 13 Jul 2022 12:23:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236637AbiGMQXG (ORCPT ); Wed, 13 Jul 2022 12:23:06 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 984CC2C13B; Wed, 13 Jul 2022 09:23:05 -0700 (PDT) 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220713152436.2294819-1-nathan@kernel.org> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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?