From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 089EA29B79A; Mon, 14 Apr 2025 13:29:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744637375; cv=none; b=AzM12xc3VGetEdGvDmnKAK2nR5AfIwCP2tloRX0vP35FSb41ZkBoPAbOCGZJud188VsJqrmMjgyw6w3pF7CSsVLTJAqp6MxPx32UhPJAOle9cqmuGVbLd09KXSeqJ8QYQBhz9KMEAJnjlvOyQNqVImBjTIKv9XjRblMdp2TX6Qw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744637375; c=relaxed/simple; bh=49YGaSD6SeXvqANPAfCZgo1Q9VCPLjXUjddcErUMfVM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=vFTl3S8JkCT9HmU0O7ls3HbQF1txc+x0y3xJoPgk7/9uuxtWKP9BQ45vOKzZzl45HFPM9TXRqJDevyIyJXMz9yEojlQOLZUGHsSBpCtXQbSA/VsTmPfDF7PWxI6P7UCng6dR2qu9p8LbXck7eGznexBeA8psttVpl1MU2wrS7lY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mytpfOgN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mytpfOgN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 085B8C4CEE9; Mon, 14 Apr 2025 13:29:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744637373; bh=49YGaSD6SeXvqANPAfCZgo1Q9VCPLjXUjddcErUMfVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mytpfOgNEBH0hYdKTWMkZ8VACVgIF8NMsPWSU7+dFsR7Hlui+vDYn1d851qWnEGth vhldZdK5J0As0d9wX/5/E/c4LEWP7LmSWI2pDBLXNLBFjUAM1xYJ/tgwQgPhW2rYYC NgAMDKDowhMjTThpRJ7rA3xJsjW3hAxmBxJySrd8yO+SWMoF84kJcg9nrnGt2lzITq Mj9exwnzhvJbB8h0wKuQZaQTe/kLeNhl9fu6Cii8QBt+k/v6qibJBQeHkLPtDkXnTo tvyldLq9NJW3SHR/YTyLe7et/PxsNuPplwrSoGBg+GqEhQOm+FYyXYeSEkWmiQAzIL +j6jA6RLwVZYw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Josh Poimboeuf , Ingo Molnar , Sasha Levin , luto@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org Subject: [PATCH AUTOSEL 6.12 19/30] x86/bugs: Use SBPB in write_ibpb() if applicable Date: Mon, 14 Apr 2025 09:28:36 -0400 Message-Id: <20250414132848.679855-19-sashal@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250414132848.679855-1-sashal@kernel.org> References: <20250414132848.679855-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.12.23 Content-Transfer-Encoding: 8bit From: Josh Poimboeuf [ Upstream commit fc9fd3f98423367c79e0bd85a9515df26dc1b3cc ] write_ibpb() does IBPB, which (among other things) flushes branch type predictions on AMD. If the CPU has SRSO_NO, or if the SRSO mitigation has been disabled, branch type flushing isn't needed, in which case the lighter-weight SBPB can be used. The 'x86_pred_cmd' variable already keeps track of whether IBPB or SBPB should be used. Use that instead of hardcoding IBPB. Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/17c5dcd14b29199b75199d67ff7758de9d9a4928.1744148254.git.jpoimboe@kernel.org Signed-off-by: Sasha Levin --- arch/x86/entry/entry.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/entry/entry.S b/arch/x86/entry/entry.S index b7ea3e8e9eccd..58e3124ee2b42 100644 --- a/arch/x86/entry/entry.S +++ b/arch/x86/entry/entry.S @@ -18,7 +18,7 @@ SYM_FUNC_START(entry_ibpb) movl $MSR_IA32_PRED_CMD, %ecx - movl $PRED_CMD_IBPB, %eax + movl _ASM_RIP(x86_pred_cmd), %eax xorl %edx, %edx wrmsr -- 2.39.5