From nobody Sat Jan 3 03:57:32 2026 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 24C9AE7C4D0 for ; Wed, 4 Oct 2023 15:47:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242965AbjJDPr0 (ORCPT ); Wed, 4 Oct 2023 11:47:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233769AbjJDPrT (ORCPT ); Wed, 4 Oct 2023 11:47:19 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E196BCE; Wed, 4 Oct 2023 08:47:15 -0700 (PDT) Date: Wed, 04 Oct 2023 15:47:13 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1696434434; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nH6tE9EI7ysD4tR/3JJt9rHH0u9Mq170wLjzJ0gD99U=; b=ujWZsBHxjEcAYyt5AIlbDWAoi6BSFH3jKCRLMu298spiQFv8K8BF1rTiwgC8fQk0VtwRCi CWXjwHjTwz57xcDM19eRXuxxC50OxXee+YuHTxg0/NPvFgeeihxVyXW7ZmgyVwQSJ+MFIh EqYd4pVXb2rI3Q5rbcpQ6MijTGi4kx9cSHqwMJ83jnBoGi2FU55YA5wAJv+vrMVOvogos5 StFoLqs/v5C4cgOU161XFil286a5LaL5BiLEbuLoSx8xDGCIKoJCm35TCgtFOjDBDXG5J3 24ztEdBYheL58dKhv/CViPCKVlmCipvbYLk4PNrzPQj7HFEIrrsBNttX/4MbfQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1696434434; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nH6tE9EI7ysD4tR/3JJt9rHH0u9Mq170wLjzJ0gD99U=; b=qVGwlninWedfbjs2YE+fdTnL94uhqCI+HFW2U3Mio+B2h8t+X3Z08RpioJwIdZ006CU0cP n5rxgUzAyvoGPVAg== From: "tip-bot2 for Waiman Long" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] x86/speculation: Add __update_spec_ctrl() helper Cc: Peter Zijlstra , Waiman Long , Ingo Molnar , "Rafael J. Wysocki" , Linus Torvalds , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230727184600.26768-2-longman@redhat.com> References: <20230727184600.26768-2-longman@redhat.com> MIME-Version: 1.0 Message-ID: <169643443360.3135.5068891650571884994.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: aaa3e6678978b5e2b5c6e80e439fc4db9bbdb375 Gitweb: https://git.kernel.org/tip/aaa3e6678978b5e2b5c6e80e439fc4db9= bbdb375 Author: Waiman Long AuthorDate: Thu, 27 Jul 2023 14:45:57 -04:00 Committer: Ingo Molnar CommitterDate: Wed, 04 Oct 2023 13:48:48 +02:00 x86/speculation: Add __update_spec_ctrl() helper Add a new __update_spec_ctrl() helper which is a variant of update_spec_ctrl() that can be used in a noinstr function. Suggested-by: Peter Zijlstra Signed-off-by: Waiman Long Signed-off-by: Ingo Molnar Acked-by: Rafael J. Wysocki Cc: Linus Torvalds Link: https://lore.kernel.org/r/20230727184600.26768-2-longman@redhat.com --- arch/x86/include/asm/spec-ctrl.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/x86/include/asm/spec-ctrl.h b/arch/x86/include/asm/spec-c= trl.h index cb0386f..c648502 100644 --- a/arch/x86/include/asm/spec-ctrl.h +++ b/arch/x86/include/asm/spec-ctrl.h @@ -4,6 +4,7 @@ =20 #include #include +#include =20 /* * On VMENTER we must preserve whatever view of the SPEC_CTRL MSR @@ -76,6 +77,16 @@ static inline u64 ssbd_tif_to_amd_ls_cfg(u64 tifn) return (tifn & _TIF_SSBD) ? x86_amd_ls_cfg_ssbd_mask : 0ULL; } =20 +/* + * This can be used in noinstr functions & should only be called in bare + * metal context. + */ +static __always_inline void __update_spec_ctrl(u64 val) +{ + __this_cpu_write(x86_spec_ctrl_current, val); + native_wrmsrl(MSR_IA32_SPEC_CTRL, val); +} + #ifdef CONFIG_SMP extern void speculative_store_bypass_ht_init(void); #else