Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp2027154rdb; Tue, 5 Sep 2023 12:01:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGPMxluzG4o9NOc/igLaarK4DztcyobIVo0O5DVqFVHOfsAa6wc+E6hHgXXlLEEbonkB7M X-Received: by 2002:a17:90a:13ca:b0:26d:4ade:e54b with SMTP id s10-20020a17090a13ca00b0026d4adee54bmr10918087pjf.17.1693940496556; Tue, 05 Sep 2023 12:01:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693940496; cv=none; d=google.com; s=arc-20160816; b=PzIw26TlBWQdG7GFsul7Vel8s+4SRPxPepQe9Zd8KZ7qB8UA/RmXblRBYz4ns+J3gF QjtEG8e1Lu2fAT47WByLCMQDOiAI3iUcEX3y3B/1T/7/KehvlGMyZI29NeisCOwqCgkT O4L/EMVG0FjjSjDMAoCJ1oaJSiaRlamD/jgPnv1T5NGoyKn+VzwL8oSLD06nDOPgmXsy Kww88SnM9CkjomXFaQXM2DI8f6fYaKDLC+af5NDLpf4HvK2RKEzl5NUsGLLNqndscpmD jQw6aP4/nnQHpEXFN3kVY3rHg5T830DdMY9icpZXO7xhAOXUTh+ZWinR68axEP2T6/ax +V2Q== 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=wvcvSW9ViN8/qvsno8j1FceCc/c7F+6UzChPdfUAiJg=; fh=ZwaEcDYNCnlh+U7YxZ1LCEcet9pcdhSkEX0cCEOksvY=; b=L2yGRXRw24zyCdZNJe9pMG8hxFn7JXqx9gkEWpHhDjodh9iwefODV7nm0CbIpCwsvK B+lZb1eABbP+00NZsghu9mqkHpeq7JkWN+KPheeL1DcwJqFPAdjRyJ5ki69zG4hKFI4U 7TnkaYSx0uJTTTCctRe57A24rJpZK4fiGM07EHGmgGQEaLBhSJVfge13J/hHKXefaka5 fl92UfPmmagx9HQjAaE89Iq3E6Svk/MIdlxE1tUdzTK7smthEA7DUyJSTVndyQYQtJBC V1PAcOfEHDYiQCeDWySvgNI2vudJ0PE2np6KsrAMMpWksOI2XzGybGdVNKY8XslBsh3T lLGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b5qqQ+As; 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 hg17-20020a17090b301100b00268278c51e3si11964117pjb.49.2023.09.05.12.01.16; Tue, 05 Sep 2023 12:01:36 -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=b5qqQ+As; 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 S232456AbjIEP7b (ORCPT + 99 others); Tue, 5 Sep 2023 11:59:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351064AbjIEFFY (ORCPT ); Tue, 5 Sep 2023 01:05:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1541318C for ; Mon, 4 Sep 2023 22:05:21 -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 ams.source.kernel.org (Postfix) with ESMTPS id AC77DB810C5 for ; Tue, 5 Sep 2023 05:05:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF7EDC433C8; Tue, 5 Sep 2023 05:05:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693890319; bh=iIGJqU3J2NKUvcB3l9LFtUkiV3+8m8mnSkkiTNLVzVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b5qqQ+AsfvqXE5J4Pt0lXq8YM2I1VnyOJY37MZAfr84nXGD2i80VtNP9ZRzhKJxZT s8kV+lz83S5Cmtl/DNOJxVsFFmL3NZhOVbkCZltytANT0WvwLnxdbrRy/V2MpVgG7+ wHy893/2CjMoB9Vsj4aRiHQnSg0lqExxp1rwWfLby0xNLwIFzpZNq3mmu8mAHhUh9i pjfk2Hk9Jy4Z8/CxOfBuroLGe4KekVgDYu2OGlp9rncaK0F6qKfkERARQ/6/p0mvGx j9XG6eIt5w01KHSLSJHc87+kAqP3hC6zPbjzoLhqZT4yjXCi93fAY6/CH/JfyL4HQz olr2peMSASaEg== 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 v3 20/20] x86/calldepth: Rename __x86_return_skl() to call_depth_return_thunk() Date: Mon, 4 Sep 2023 22:05:04 -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=-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 9731e814dcb6..016a32613259 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