From nobody Sun Feb 8 06:49:48 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7EA00202F96; Tue, 4 Mar 2025 10:26:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741083989; cv=none; b=ee10WGvRcn/KZuM7b8Mo1nQJf/TMWbH2gMlF6i6DqUy98qRk4b3IsNnd5zJbr0YnJB3rPrqg3MCFgRZ93XWX6K2bngnf7sD1q5Ji8wWeYcCPRksu/JMd7tRaFb1xL+AMe6+t06IDXFVu2LdQTnpcgMtM+N8F6ygJESbTBCtPZN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741083989; c=relaxed/simple; bh=Ie7WO4f/CXgFKqoDY6nKzFss+o4mjNMkssHx4VLtSvE=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=aWGobO2B5SZ186O88Yi1F9gt14pHL2TGb3b2Opf4cKJlRJnwXc/py/MuYvHsWHAI127oMrhx1Ojegv/tJmh7tu6PgOqjf9wHQRPsjzq9WSRZNjDijmcyD+p1Gj0DOnPlR1qrUFo86Jqq2x21/RzETT8xk+x0ZRQIqhYiXfUHoXA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=oldnpnP+; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=l1yOjHBe; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="oldnpnP+"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="l1yOjHBe" Date: Tue, 04 Mar 2025 10:26:25 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1741083985; 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=OfkyRlVGgRbWCEcHW0zfiId2WrFaEDaVnkd9hXZkm/c=; b=oldnpnP+8+tXcqdzHmaPWLgox/5hBojawkTWLi4z5ChklgrPe/o4jivBzaXjhLxKMJKVnr 9reCKyGDy4ix5/+gbHOsnUgAERZoqZWPA9V0KVbOattku4ltIMblEYd2vbzecRCQ9pDFW3 HgETxoAsl+tcTiA1+kZc659ov4qKhohZ7FUEMJ8+KAYwS0Ip/nlBM8iXGxMtaTfO+RQGQE eSR5xKts3aJguHt0Ms2MIs7jGdDIvZ1Bs8Utp9EnxdoFGGe9ZBvCiD+TAVNJzUc5egAOem d66XgMCrJ/G/BEJfbErjfkctAE8nG/uMo3JwL974ITUJTFcSiUfeMawxBpRCNg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1741083985; 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=OfkyRlVGgRbWCEcHW0zfiId2WrFaEDaVnkd9hXZkm/c=; b=l1yOjHBe3r9DGSbaOLYVPgwJeqf8mHjS3TScbhhHJCblFw+4y22/AgwrWL7QZVRVpS9FK7 WS6LuOuuA14nvfCw== From: "tip-bot2 for Pawan Gupta" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cpu] x86/speculation: Simplify and make CALL_NOSPEC consistent Cc: Pawan Gupta , Ingo Molnar , Andrew Cooper , Linus Torvalds , Peter Zijlstra , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20250228-call-nospec-v3-1-96599fed0f33@linux.intel.com> References: <20250228-call-nospec-v3-1-96599fed0f33@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <174108398503.14745.3531917844748876019.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/cpu branch of tip: Commit-ID: cfceff8526a426948b53445c02bcb98453c7330d Gitweb: https://git.kernel.org/tip/cfceff8526a426948b53445c02bcb9845= 3c7330d Author: Pawan Gupta AuthorDate: Fri, 28 Feb 2025 18:35:43 -08:00 Committer: Ingo Molnar CommitterDate: Tue, 04 Mar 2025 11:14:35 +01:00 x86/speculation: Simplify and make CALL_NOSPEC consistent CALL_NOSPEC macro is used to generate Spectre-v2 mitigation friendly indirect branches. At compile time the macro defaults to indirect branch, and at runtime those can be patched to thunk based mitigations. This approach is opposite of what is done for the rest of the kernel, where the compile time default is to replace indirect calls with retpoline thunk calls. Make CALL_NOSPEC consistent with the rest of the kernel, default to retpoline thunk at compile time when CONFIG_MITIGATION_RETPOLINE is enabled. Signed-off-by: Pawan Gupta Signed-off-by: Ingo Molnar Cc: Andrew Cooper Cc: Peter Zijlstra Link: https://lore.kernel.org/r/20250228-call-nospec-v3-1-96599fed0f33@linu= x.intel.com --- arch/x86/include/asm/nospec-branch.h | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/no= spec-branch.h index 7e8bf78..1e6b915 100644 --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -424,16 +424,11 @@ static inline void call_depth_return_thunk(void) {} * Inline asm uses the %V modifier which is only in newer GCC * which is ensured when CONFIG_MITIGATION_RETPOLINE is defined. */ -# define CALL_NOSPEC \ - ALTERNATIVE_2( \ - ANNOTATE_RETPOLINE_SAFE \ - "call *%[thunk_target]\n", \ - "call __x86_indirect_thunk_%V[thunk_target]\n", \ - X86_FEATURE_RETPOLINE, \ - "lfence;\n" \ - ANNOTATE_RETPOLINE_SAFE \ - "call *%[thunk_target]\n", \ - X86_FEATURE_RETPOLINE_LFENCE) +#ifdef CONFIG_MITIGATION_RETPOLINE +#define CALL_NOSPEC "call __x86_indirect_thunk_%V[thunk_target]\n" +#else +#define CALL_NOSPEC "call *%[thunk_target]\n" +#endif =20 # define THUNK_TARGET(addr) [thunk_target] "r" (addr)