From mboxrd@z Thu Jan 1 00:00:00 1970 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 3BBA1C27C40 for ; Wed, 23 Aug 2023 23:03:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238844AbjHWXCl (ORCPT ); Wed, 23 Aug 2023 19:02:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238766AbjHWXC1 (ORCPT ); Wed, 23 Aug 2023 19:02:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E63FAE6A for ; Wed, 23 Aug 2023 16:02:25 -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 7BF2C621A7 for ; Wed, 23 Aug 2023 23:02:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 151B1C433C8; Wed, 23 Aug 2023 23:02:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692831744; bh=WhX3zLWGYSRH2yPGhaYBMOCl/7AhpHMP0Lzuwzz0UdE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qiM3D0H/zZdxxW/pxQT/vqg9OJKDh4C4BuD1yQUOTeK8qOk6wWODdpUffpphjGrwT 4/2wbNvRoOt6haZV1PtK/np8hU+f2Ouqx/V3SmEPhtNoKbJfEXg+Lz/9rnwL1/12L3 24LUtnfJrXqG4YjYH+qSqZioNaUNd2Rici5LwiN8Wr95dQrecADJjbvRhvuHM6Fl/Q mgU6gmyOb3e/Dv9tnD9yiSGrsJ3FPUs+0Vgbg5SKUQ1/Mp2Cd3TscFzSpyHLji3+xe GPv7IqXBWZYzhkpg1e3An3t50m67oyAgEV1cRptEZrkRO3hltYXGe3k38B3FZGyyDc K8YXiq5m914xw== Date: Wed, 23 Aug 2023 16:02:22 -0700 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: Re: [PATCH 05/22] x86/srso: Fix SBPB enablement for mitigations=off Message-ID: <20230823230222.a3eqe6h3qvzrrulz@treble> References: <141c92f20ab46cf0c028e86b946134cd702d0ea5.1692580085.git.jpoimboe@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <141c92f20ab46cf0c028e86b946134cd702d0ea5.1692580085.git.jpoimboe@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 20, 2023 at 06:19:02PM -0700, Josh Poimboeuf wrote: > If the user has requested no mitigations with mitigations=off, use the > lighter-weight SBPB instead of IBPB for other mitigations. > > Note that even with mitigations=off, IBPB/SBPB may still be used for > Spectre v2 user <-> user protection. Whether that makes sense is a > question for another day. > > Fixes: fb3bd914b3ec ("x86/srso: Add a Speculative RAS Overflow mitigation") > Signed-off-by: Josh Poimboeuf > --- > arch/x86/kernel/cpu/bugs.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c > index 10499bcd4e39..ff5bfe8f0ee9 100644 > --- a/arch/x86/kernel/cpu/bugs.c > +++ b/arch/x86/kernel/cpu/bugs.c > @@ -2496,8 +2496,7 @@ static void __init srso_select_mitigation(void) > pr_info("%s%s\n", srso_strings[srso_mitigation], (has_microcode ? "" : ", no microcode")); > > pred_cmd: > - if ((boot_cpu_has(X86_FEATURE_SRSO_NO) || srso_cmd == SRSO_CMD_OFF) && > - boot_cpu_has(X86_FEATURE_SBPB)) > + if (boot_cpu_has(X86_FEATURE_SBPB) && srso_mitigation == SRSO_MITIGATION_NONE) > x86_pred_cmd = PRED_CMD_SBPB; Actually, I remembered this patch had another purpose. On future HW, if SRSO_NO is not set by the HW (which Boris said might be the case), and the SRSO bug bit is not set, then SBPB needs to be set. I may just get rid of this label altogether and just hard-code the setting of x86_pred_cmd in the two places where it's needed. -- Josh