Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp814854rdb; Fri, 25 Aug 2023 01:42:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFUq4qdsWahvXko+7qWIGZoAl/bKnzuxRc2f25Ef2Ij33QJTRPkxBxUQVcLMbd/e9vLuW9N X-Received: by 2002:a17:906:9bd3:b0:991:d2a8:658a with SMTP id de19-20020a1709069bd300b00991d2a8658amr14288343ejc.34.1692952942892; Fri, 25 Aug 2023 01:42:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692952942; cv=none; d=google.com; s=arc-20160816; b=kvWThedkRVMoL9prVSOgzjtbVkciixeW5NPrp1t6C3WvbhY7sEuKJYwUKAi2Th9BdN GuGivrjrcVrW5WN8n4maqI9dV5dyVUj8lmmq5rmg+tZ7kotAQcyl88P2DGhn1xK/G4T7 8sbryn1Ev2qxZHUrOkWDiCdUSsHFVpptt9We3Iq/TebYIF1WaTR6SDUixxZHP7bRz98H Vneo07WuI/9n2yf2+0rXKVu5/bWdLFBZh5PF9EYKiiE4BH2wr56cGMBglBF/kyjrvAGm IRmpb3W72gwfVTW8uIr5AqxEChNzLLtlqawXLRmZGuxmvQpI+nUf/ud3w/M8G7lw0Hue s9Rg== 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=RjCEDEMas/2+is0gbsCUfs1a7y+agCO5xOQv8Irwx3c=; fh=ZwaEcDYNCnlh+U7YxZ1LCEcet9pcdhSkEX0cCEOksvY=; b=03UvGIP1BuC8eYA6qXxTt9Ohl931OuyUrS123balzjsEM2bHjGGsPQH4HJexebAQr1 Lk7UeozkiYnon4rfkpkF93y6cOtzCR8d2srLT3/pXjeZW5qS7p5XOC567n0kCVnTRrj+ zRoJyTYhFuq6V30O6x/HjdWmWtn90mlovfWrDedk8jwhoazaEmGJjzD1ZH+i9N0acTRj N+BYitQrrXZi1wXOQOGQd/ZOdkzag48mzyy8Z3y2su6HT5dZbhA+FPd8v1Zu88I5xmG9 R7u38oSUEOB8hHJ3f6XqoqAgMmzcNRWqrMKshzTmtlENQbTfRKl4qnSbTWFO+8ZfBi2i JUvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lWw6vjKw; 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 p19-20020a17090635d300b0099bccca6765si711897ejb.239.2023.08.25.01.41.50; Fri, 25 Aug 2023 01:42:22 -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=lWw6vjKw; 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 S243331AbjHYHD1 (ORCPT + 99 others); Fri, 25 Aug 2023 03:03:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242764AbjHYHCS (ORCPT ); Fri, 25 Aug 2023 03:02:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C45A19BA for ; Fri, 25 Aug 2023 00:02:16 -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 D3D1964ED5 for ; Fri, 25 Aug 2023 07:02:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42AEFC433C7; Fri, 25 Aug 2023 07:02:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692946935; bh=qsN5fAL0UsUoSJcEpWiXx8vVd/Jvk2WQgwwzb5VuTEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lWw6vjKwZH0ltKx9O3crMYeFlPTTvFdsfy3+9EX6qPbHNjuFg9PB24kQW25u1l4vR CqD4Z8iANhXwWo7Z6dcH/t3madn2bl1CC5CL0ustsfe5A+AVAZZijiOrvF3DBvzXYo 4rghAtZ7K1RgzCzLSnIvn3xr7O2Ky3Q4mMCeINVExGE0q9mdusRNuu4r/ldvH0i+hk 7rVCXfMQaNgueTX6CKv2dD47WeUvqwh49UKplrWKrpFXxyQyNjXoQDmRcWYwBDhUtM Z0zNCczKBfGNvbA7Z+ZkIbEhMJKORDNRyF5V3f4tgfcIzocNO24IqHxhH9i7MWwRyP 7cv4XD+Jnr2SQ== 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 23/23] x86/calldepth: Rename __x86_return_skl() to call_depth_return_thunk() Date: Fri, 25 Aug 2023 00:01:54 -0700 Message-ID: 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=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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 0ebdaa734e33..d538043c776d 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -1059,7 +1059,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