Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp1170061rdb; Sun, 20 Aug 2023 21:53:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE3BROjIW7gChosDd5EpTuuuzSOfkh+by6tnK/ChKtMQgw5swjd4V/Lsb3x0JH4JhTE6At2 X-Received: by 2002:a17:906:8a6d:b0:997:870d:e8fa with SMTP id hy13-20020a1709068a6d00b00997870de8famr3599644ejc.1.1692593612967; Sun, 20 Aug 2023 21:53:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692593612; cv=none; d=google.com; s=arc-20160816; b=AGFlteQQZJa5fK1t79tC+AQxwxssqxpqWeMaerc78F6DrApN37izNCkSTWdKNnVcv9 9EWVjFabU1f2y1OWndATdYvU5GHSuOPkQIVmmArDytI8OdrPs/IFuPzNCGdBmXZ+2eM9 NUgoeoP6JrsoGJopj0VMwkPMNnZbeC0Q0W/BxAIHfCADbrdBmCxPyYdWJWNJZIFkx3/n 9nE0KOz5S3YYVN9UHsQVAYlzA9+rt7Jhs0Y+JLHvtJkN3UbtKXQF9SRS7jbeg7ydtpjv q6ZnIXyy+wT4z7GZd4SufpGWc7pbwNmRNhj1wq0Zs12RnCZyJaJOs1kdyex/V26Cij9Z eflA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BoxTIOjbJkF9d/QZ7D5VcIG1YBivXuklsKePLau3a9o=; fh=1KVrD/LnRsN9N7k2d12iARV4DA2tVMW012QtKSrD46c=; b=Gw3XHGXc+A/KAOGHbXHKNOQG7/MbnG2A3OnL6nKl42YO+u+Vm+YSCFzIatecH8qxph cI4Ph4oqCD94WUrfYv7iRWsvc3GVXxVqPpPKzS67lCSBbqb5IwOnVSYt1cfVkvhAJmuX dGfcYS2SLzEv1FEk+py1nTBOePkwrJ+yEg+PnQgYJh/gWuATQ9n4OjELLGC2VJO1npfx tYreGsOmY1XaiOJQs+vEzVWVQa25MqaQdeFUnqZsk6/YARxKyJB36h3zd8ImymDNkcS3 IWfeyGxShm21DNmbnk5HLr9y22u+dEw9Nw+3frGyIlhGoHtNYKsAUyjNrG7aHSyPd00N XNHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hgZ+MZWK; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k2-20020a17090666c200b0099bd046b94bsi4919034ejp.1050.2023.08.20.21.53.05; Sun, 20 Aug 2023 21:53:32 -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=@kernel.org header.s=k20201202 header.b=hgZ+MZWK; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232418AbjHUBUQ (ORCPT + 99 others); Sun, 20 Aug 2023 21:20:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232419AbjHUBT5 (ORCPT ); Sun, 20 Aug 2023 21:19:57 -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 64F52FC for ; Sun, 20 Aug 2023 18:19:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D66FB6268E for ; Mon, 21 Aug 2023 01:19:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D656EC433CB; Mon, 21 Aug 2023 01:19:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692580780; bh=qkJxCGkZPlZlG/BJ/AajbqkIuFwM6PWAkTDJOR+28gA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hgZ+MZWK2NryulPLM9PrOKBnFkY3uqEpDHiVYoKoHLJQcRXIKrFPLX0r2pZetKAH9 HtQZcSe3BBBrvXhL/pidiOB4ZyfGwSXIOhcFM9YFzKipw38Sa1xgKdXcdEwiNf1oac 5KY9S4dr/XYOE6XTZ8xwMjrpNtftuKgr+18FVB9k/1fWqDIV/jB6R3OL9I+4v4rw+l cjfd7YGdVoiOQreiFWDbLn6vdq7QfcA4ry1Q4yPIMT4WUrB//u9/BivH93MOdfPm43 a0ruG+IhYdMmv9pMWkcxBX4kAiJVTKy+7oKosmuTn1NCwKNY3X7f2QRpqQfuUf9E4+ P3fzAEk720UYg== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Borislav Petkov , Peter Zijlstra , Babu Moger , Paolo Bonzini , Sean Christopherson , David.Kaplan@amd.com, Andrew Cooper , Nikolay Borisov , gregkh@linuxfoundation.org, Thomas Gleixner Subject: [PATCH 22/22] x86/calldepth: Rename __x86_return_skl() to call_depth_return_thunk() Date: Sun, 20 Aug 2023 18:19:19 -0700 Message-ID: <1d7c2ce1c5723902389e0268042f1c98a8783c46.1692580085.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 For consistency with the other return thunks, rename __x86_return_skl() to call_depth_return_thunk(). Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/nospec-branch.h | 13 ++++--------- arch/x86/kernel/cpu/bugs.c | 3 ++- arch/x86/lib/retpoline.S | 4 ++-- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h index dcc78477a38d..14cd3cd5f85a 100644 --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -358,12 +358,7 @@ extern void entry_ibpb(void); extern void (*x86_return_thunk)(void); #ifdef CONFIG_CALL_DEPTH_TRACKING -extern void __x86_return_skl(void); - -static inline void x86_set_skl_return_thunk(void) -{ - x86_return_thunk = &__x86_return_skl; -} +extern void call_depth_return_thunk(void); #define CALL_DEPTH_ACCOUNT \ ALTERNATIVE("", \ @@ -376,12 +371,12 @@ DECLARE_PER_CPU(u64, __x86_ret_count); DECLARE_PER_CPU(u64, __x86_stuffs_count); DECLARE_PER_CPU(u64, __x86_ctxsw_count); #endif -#else -static inline void x86_set_skl_return_thunk(void) {} +#else /* !CONFIG_CALL_DEPTH_TRACKING */ +static inline void call_depth_return_thunk(void) {} #define CALL_DEPTH_ACCOUNT "" -#endif +#endif /* CONFIG_CALL_DEPTH_TRACKING */ #ifdef CONFIG_RETPOLINE diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 73d10e54fc1f..83eb3f77d911 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -1060,7 +1060,8 @@ static void __init retbleed_select_mitigation(void) case RETBLEED_MITIGATION_STUFF: setup_force_cpu_cap(X86_FEATURE_RETHUNK); setup_force_cpu_cap(X86_FEATURE_CALL_DEPTH); - x86_set_skl_return_thunk(); + + x86_return_thunk = call_depth_return_thunk; break; default: diff --git a/arch/x86/lib/retpoline.S b/arch/x86/lib/retpoline.S index 49f2be7c7b35..6376d0164395 100644 --- a/arch/x86/lib/retpoline.S +++ b/arch/x86/lib/retpoline.S @@ -321,7 +321,7 @@ __EXPORT_THUNK(entry_untrain_ret) #ifdef CONFIG_CALL_DEPTH_TRACKING .align 64 -SYM_FUNC_START(__x86_return_skl) +SYM_FUNC_START(call_depth_return_thunk) ANNOTATE_NOENDBR /* * Keep the hotpath in a 16byte I-fetch for the non-debug @@ -348,7 +348,7 @@ SYM_FUNC_START(__x86_return_skl) ANNOTATE_UNRET_SAFE ret int3 -SYM_FUNC_END(__x86_return_skl) +SYM_FUNC_END(call_depth_return_thunk) #endif /* CONFIG_CALL_DEPTH_TRACKING */ -- 2.41.0