From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B4DAC43334 for ; Wed, 13 Jul 2022 15:22:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236090AbiGMPWr (ORCPT ); Wed, 13 Jul 2022 11:22:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236484AbiGMPWn (ORCPT ); Wed, 13 Jul 2022 11:22:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1B1D46DB2; Wed, 13 Jul 2022 08:22:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6079A614AD; Wed, 13 Jul 2022 15:22:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33289C34114; Wed, 13 Jul 2022 15:22:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657725761; bh=M3s3z9XPrbSeW+ifjj4FlEwxjuV9nAI5u3w331qUeyQ=; h=From:To:Cc:Subject:Date:From; b=oJNOIyWhDB/OL2qVkQeFvanYA9xYBoaLVB7SSptFZZGaax6vHQOYNKi04FQjuVjBP RQT3STyQhVJCuh69pd7dgNk+6GHzytZKFoX4B5mzy3H34qa2NTuzTQmTw2w+KHyHrt JuRM9czFqm/akALRtKKfZU/g9zf2O9OUYwSbDzu9nvQomSSlhglqH94HDk0oYoGKH2 SyQVkxrQQ03sYnlJmXt+JXyJs7qycJwSZr8ISuJS9mxBSn/xaGlvs5CYcCmqhq+pfE LqrP/OQw4a7tiUD+sjYiZFmJO7wSxP0Q0FoGaXu8/Rse+dBkMKPxWbhySSP9xNaNPM 4KR/HaDclrQ9w== From: Nathan Chancellor To: Linus Torvalds , x86@kernel.org Cc: Nick Desaulniers , Peter Zijlstra , Josh Poimboeuf , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Nathan Chancellor , stable@vger.kernel.org, kernel test robot Subject: [PATCH] x86/speculation: Use DECLARE_PER_CPU for x86_spec_ctrl_current Date: Wed, 13 Jul 2022 08:22:22 -0700 Message-Id: <20220713152222.1697913-1-nathan@kernel.org> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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..99a29c83adf8 100644 --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -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