Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp831427imw; Wed, 13 Jul 2022 08:43:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uMhriqJ+8CrIyykiluH7t4MlpOXTZyEUEIo1JVFZSgy5HdbOxhDoA6hGWRXHcRVuZt8Q0m X-Received: by 2002:a05:6402:50ce:b0:43a:c86a:b897 with SMTP id h14-20020a05640250ce00b0043ac86ab897mr5794427edb.321.1657727030456; Wed, 13 Jul 2022 08:43:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657727030; cv=none; d=google.com; s=arc-20160816; b=O0wrMjMjopu1nZWTXbnNVOeFygt/ZsKWO33L3QAadBI/WLkqww92yHgS1tfrc/qPbY r4+Z0R5OPCePBq7s6l2fa3sOgXrj99o8oNGvBUAckDStOZHuJO5DhvX1cdnLZciyGIXl eLEmJES6jssUqo8Nvi0hmV7e0ZGWYHGkw5iXFr7iZF2HNG01OHqB4MdBW0lZEsGHxb/L iCH0Xb9YIFV4yTF7uWErBLH58ssdgYbKU4V6lW/LStGhtXKLZxUULlKG8uFhZUBzhIK+ WiGW8gdY2ZDcMboPRXym1BiZAasnXgWmRl2nABssFxd0fy1xRA44He+xIhDqPK8psuQg ZXSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=frSkO8LINr4fIYviWk98zCOOmU6Ew1V0tF2nZHNwdSA=; b=BTa/LatpUfxMRoZ8AgcaauKYkw/xfXV9VJRCkKpEdNtB6kVpnJMhlhJl8HOPGk3uwj 0zMjMjxiEE6gFiGuwqQpGFi+GJaNlrHsOa7FeO/Mcm52ysu/rSfTnOrqT9NOFq7Vza+s jo18w8jhjgHMC4Xtb0IIXXfc7HcSvsSTDV8w1N8rEFqYNHto2BnhrUa4TVuT2aCPcoav OLqfyFpPJN3hCI3PBz9ZwA7i/Z+ZZ0Mu0Ite2zIOhxp1rh+G5QICrDCNwRp0yBSLNpq0 qSSD/tV96aVm6OgygELdQ44Id43HIdzOIBU1VgC6Ex1p03W96azGjUrOG8xHpXalrOek BspQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="M/KSRgcU"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x21-20020aa7d395000000b0043a69ee06c0si16082371edq.68.2022.07.13.08.43.25; Wed, 13 Jul 2022 08:43:50 -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=@google.com header.s=20210112 header.b="M/KSRgcU"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237034AbiGMPgo (ORCPT + 99 others); Wed, 13 Jul 2022 11:36:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237037AbiGMPgc (ORCPT ); Wed, 13 Jul 2022 11:36:32 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B86D4D830 for ; Wed, 13 Jul 2022 08:36:31 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id o12so11293450ljc.3 for ; Wed, 13 Jul 2022 08:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=frSkO8LINr4fIYviWk98zCOOmU6Ew1V0tF2nZHNwdSA=; b=M/KSRgcUcJQvDr7kv37lS/FPE1C7EbhTDrVDDTHUGdFcWeTMm1zdyz7dfRaZjKSNeJ R26kPb8JFoIXs7POF8i38ksSux8OlP8OXdhXJlM/MIglrSReWnjFtEs2LDnRVN23UF8S pHVJVBM1yWymWPM/QFPzJ6kd2xvPT6e9/dJs07TmM/omaRNAtgFb1WYxL3pOsmO3Hr6b mx32ykTgWBKQu+5zdxVRH9Xn1wM+ivrsi75SfnhLUP3/wB7WVI3Br2cdwOBciYXtZUZB Y+SGKQxXcAAUdavWfKJeKi30cyXlCNdzpZ4myP8VydIPvoGrdmxVEaj0z23T6CV4UVaf 948w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=frSkO8LINr4fIYviWk98zCOOmU6Ew1V0tF2nZHNwdSA=; b=rRNPhxH4ZvSW3FNFtqiw1t1pnQx2sXE4qNQZiDkc3FRjxI1tzD6Z4RUgWI2b+Rv/Ab 8r5Pf6QcOXC4o1/oiMaDfiOEvtkmqBE80oV9A+Kb+PAlDpgNKVUkv3nuwOMQJ95I1giP m3PscvNHkkNmDskHL89K5+hrXifzlv4watNTa/8sIUvpFAomni/iSAr+DpQtmxz3v6qf qJ4GknpuJzzWpg88x/tmvAdsymRST8jLJjkJ6/C9anx1UCWRp1RORM2JT2pZr8Gw6KJe ftIrP6ZadgwNPy/2xlPk7GJ694rWMLmKMYuPOWrvb+0NEcyV4LKwRhMQNxi+9yZPrUA+ 5+vw== X-Gm-Message-State: AJIora8QZuCT300qQ4g6zgVn8XZUifnapu3bckEtZbv7ee0pSaGV0M3l xQwNK7uvVRu8VXTADuDlNuj0tSFBKrL67lYJhQQDzkfDjD4= X-Received: by 2002:a2e:8609:0:b0:25d:6af0:63b5 with SMTP id a9-20020a2e8609000000b0025d6af063b5mr2153523lji.360.1657726588005; Wed, 13 Jul 2022 08:36:28 -0700 (PDT) MIME-Version: 1.0 References: <20220713152436.2294819-1-nathan@kernel.org> In-Reply-To: <20220713152436.2294819-1-nathan@kernel.org> From: Nick Desaulniers Date: Wed, 13 Jul 2022 08:36:16 -0700 Message-ID: Subject: Re: [PATCH v2] x86/speculation: Use DECLARE_PER_CPU for x86_spec_ctrl_current To: Nathan Chancellor Cc: Linus Torvalds , x86@kernel.org, Peter Zijlstra , Josh Poimboeuf , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, stable@vger.kernel.org, kernel test robot Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 8:25 AM 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 Thanks for the patch! Reviewed-by: Nick Desaulniers Tested-by: Nick Desaulniers > --- > > 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 > > @@ -280,7 +281,7 @@ static inline void indirect_branch_prediction_barrier(void) > > /* The Intel SPEC CTRL MSR base value cache */ > extern u64 x86_spec_ctrl_base; > -extern u64 x86_spec_ctrl_current; > +DECLARE_PER_CPU(u64, x86_spec_ctrl_current); > extern void write_spec_ctrl_current(u64 val, bool force); > extern u64 spec_ctrl_current(void); > > > base-commit: 72a8e05d4f66b5af7854df4490e3135168694b6b > -- > 2.37.1 > > -- Thanks, ~Nick Desaulniers