Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp2387517rdg; Mon, 14 Aug 2023 00:13:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEdnrRnJw6YaJ94aRTZwg8ZFudjLmk8uAnXRJgIuH02Hxp+aq9vMbmTD+u11rZCcbLU/cQi X-Received: by 2002:a05:6808:1316:b0:39a:bd0e:43d with SMTP id y22-20020a056808131600b0039abd0e043dmr12374217oiv.36.1691997213934; Mon, 14 Aug 2023 00:13:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691997213; cv=pass; d=google.com; s=arc-20160816; b=Dd5HgKCZxPBH9TSDS+ut6MRO2DMsHK0F56PpUjim6Xh9o7NO1sBQQGiEQ7GB96Cz0f mXPFrWB7LM9Aew1lDrsPly2QVjAejOArfyfSVN7GhYbQvv8tcZiZVInGPPQPuuoFSi6S +Yzo6qU1xXDV5fdoXGYcVUolSW4icQHiGR7Nz3fv/wVUfSZaIuTzNO0hTJeE6zW3dX0K 2gNHnYT14GtEsd1zgzsZcaKpGZlviwo2Yx9+/DOuD2uUoGIwF3wJPozW7IpNKngJDJ9t 0wPjEhfu2frUuBaWPwR7JHc0YjWJ4ontJxL6ofEAHCBG5Dv6ICH+Q4HBW4LH+srDTZCy WLPg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=1dX3iG05bCMHGueaDoMwYAeggP4Jr4j3hzbRMC/OGeQ=; fh=cbCt45lb37D4Ib+fiFu9KPH8W/8wSWhhNtrOF78ofJo=; b=ABNeicKJLoiFgBgKnhnmyVo/y3wxGWlYW41tJEyJKaxw+1eFol9dxc+A95SRo+9vBS UsLuKKPIpm3g3Mkc3eYj8m28PbTAy87m5hAo6UFjSA6U47eDwTM8l5w4mvASP9DV9aDU KPgGQusaBAIWmNINfb/Yoh2bGwauiplPas2N4NkZbYwl5zAtzISl7PVOnryqfla7vdNg 4gO1pSOpQGQ4AXOz/DNonknZzyNMpnqlAX9b24B/sQY302aEnpoxtdsv0MbY+gmIBLId X2tcBRy0wFG99uY2sL4a5sWWQKCljoxt6I6aXcMYH5RXkOHViHGVDuVP2WSv1KC80dWo fopg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=selector1 header.b=k8wb4fMM; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l7-20020a632507000000b0055be61476b4si7762943pgl.288.2023.08.14.00.13.22; Mon, 14 Aug 2023 00:13:33 -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=@suse.com header.s=selector1 header.b=k8wb4fMM; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231678AbjHNGj3 (ORCPT + 99 others); Mon, 14 Aug 2023 02:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233845AbjHNGjR (ORCPT ); Mon, 14 Aug 2023 02:39:17 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2054.outbound.protection.outlook.com [40.107.7.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AEECE5C for ; Sun, 13 Aug 2023 23:39:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S3mH84SKRapxIItDtCYz+HpceqeLL41NMFyKOOAqvaup+fjG5MiFD3HIjESGsxTARAlZRfWcjog6bzilAddSwkb0B694fkWUMZ4pkIve7PWxbNWIDbQwqMlvFniTzGx75Qr6x4CSaK0eAMvFByHFsJqu1KokRO3tMsY+KiTcGpN0rhjXtj4DOwB/iCyLbeGAA8mXiifdRFi3zZiWiQJmMZwmHjg7MMz2W6ywNUGXRxQKtrWlhBVZM7W56rImLBW/v0pEU4yBTEtWaFaQPkznw7L4rtu1disbGQg79HTkaxLp+fXj3RvIVV61DMl4HGjVAdMcz7drXMjqTnBggI9HnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1dX3iG05bCMHGueaDoMwYAeggP4Jr4j3hzbRMC/OGeQ=; b=eSOX+AFmoSSsBwK/tNEpBiJRWoaUN+pJxe8zQqy3t2VYesDDajvoLAEjufgtXi2/XTxNdfBccUU636hVLz6cOvFv5dt7oJDl1OoMLSFKrc37/r5j3hZl+5IBo/oVXKpzKnhPfmccwPixXo2hxdX56LecmnWsNc/xhvvfjw3vR+mbjb5tOqKjfRDQU/NBVAfUO9IPMTx3cQIvh4kYgCvDV46iKm8h8Jmoxv3TQ9rb0evtSoYC9FCkA5e2P9ETSf/hjp4UG3w3uyI7vBE4fhp+5GL0kiEZuSO2c5O/s2Mn2KE5rqgKjWP+/rJjAOWWqwVx/+mMMAHkCDHiqOqq2j2gig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1dX3iG05bCMHGueaDoMwYAeggP4Jr4j3hzbRMC/OGeQ=; b=k8wb4fMMoZwsGQodEYSr1uQvNoAPJgfWJokVSbKCxx0k97KW3AF8koM6mBCLLhy0Q/ygQz8yBZCVrlGggKKyhYasGQwZowA+BeAfQRWdSzezt3nHr3WQIycMrYR2FgbKlNcPJzCWudOXWQsEAdqLXuutIwF7uR0HNysaXown+fp05BpnjjuNHUSyUceiXMlBvW/iKgx3HKTjl//Evoz4QPQMMJT6/OTB0a7z3ZKp14n3j6/bF1rE3cByji7RVuR0l/xprnhHih47G8glV7aQZaH+1RHTFtTuWp2LFL1zUddsrRdRxmBPWmhHgWz/jZRpcAnq0ZxiNcIo5RQlQ6D53g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from PA4PR04MB7790.eurprd04.prod.outlook.com (2603:10a6:102:cc::8) by AM9PR04MB7489.eurprd04.prod.outlook.com (2603:10a6:20b:281::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.24; Mon, 14 Aug 2023 06:39:14 +0000 Received: from PA4PR04MB7790.eurprd04.prod.outlook.com ([fe80::274c:c30b:ac8c:2361]) by PA4PR04MB7790.eurprd04.prod.outlook.com ([fe80::274c:c30b:ac8c:2361%2]) with mapi id 15.20.6678.022; Mon, 14 Aug 2023 06:39:14 +0000 Message-ID: <1588ed00-be11-ff9d-e4c2-12db78cca06f@suse.com> Date: Mon, 14 Aug 2023 09:39:11 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] x86/srso: Disable the mitigation on unaffected configurations Content-Language: en-US To: Borislav Petkov , X86 ML Cc: Josh Poimboeuf , LKML References: <20230813104517.3346-1-bp@alien8.de> From: Nikolay Borisov In-Reply-To: <20230813104517.3346-1-bp@alien8.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: VI1PR0902CA0046.eurprd09.prod.outlook.com (2603:10a6:802:1::35) To PA4PR04MB7790.eurprd04.prod.outlook.com (2603:10a6:102:cc::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PA4PR04MB7790:EE_|AM9PR04MB7489:EE_ X-MS-Office365-Filtering-Correlation-Id: a33c3a69-efca-4fef-a7e1-08db9c912cb5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x28RIF6VGAEjru6+WXMXNpQW/yD/MZBeJd9jEQ6pQ1Bmign0bKMJoVKXeEGfl7+B55TRBkcUG1xGXvxSNWm97dVV2h+K6bJP7VGegj/31S6T6oj30o8vT9Y586O1FXVzJn/CoxbjtQ4l+kjdxpabcDHAtLLScX/fZdggsqPobjytTjTVYFCN6ZUlBI3oBRcFU0YI3ITvQy5WV0dx+iX4/edxHiEkjLfB0+rFXW0AyqxzsxdBvwfaFHvXTdSrBpJU0oX5RhD2ycJ16uuirOTvfcfslCFh0R77gChcsWavHX2eo8WYdJ+kBrGVTv/on6RzmJhY+1LY31lvZFf4bcbbsaGff/GxCCGlnQbhK2qU50v+sl1PUiSsDEr6WHmrZTgcJiBlRvBaTM5AyVLkqS4ClIkSSJpqteL/hdz++nrZlSTDukd4lJg4whOPSUhqA3W/cwbCszaooP/iowZK2I4zAY278zOAr5edL9iH1grGeUNmNY3DoVaZiMnFMnzouCnbPfJGd4wyLYmAZ79Pofeq1BHx08qCZAsjiH8PlHXG8FIpYo/s90NHhq8CdVydZsY8KCd9f6PVbrfHYPb3iX2Dpo1eW8iAsZ25NNoedpzstfw34AiRcI+LlNY1gAI+EjD8y51up6WiJ+Jefi5bKc4L7A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PA4PR04MB7790.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(376002)(366004)(396003)(39860400002)(136003)(1800799006)(186006)(451199021)(83380400001)(41300700001)(8936002)(66476007)(66556008)(66946007)(8676002)(316002)(6512007)(31686004)(2616005)(26005)(6506007)(6666004)(6486002)(54906003)(478600001)(38100700002)(110136005)(31696002)(36756003)(86362001)(4326008)(5660300002)(2906002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aGhkcVdWdzBsSUZPS2FWNTNKY3lHNENmWnlBN2xRT01MaGRlOEd5YkVmd3hJ?= =?utf-8?B?TU5GbnZVUnowR25iY3h6WldVTVhjWjJCSWk5WjUwV2FWT3RSaXN0emFvQVRp?= =?utf-8?B?Q09tT3ZuaXJtL3plbjY2cFlBcm5GY0J3Mk42TGYyejB1NjY3WDA4U0lXeThV?= =?utf-8?B?Nk5wYXFEUkhIRm5tamRrRVN2SG0zS2d3MW5oTFlOaC9UNWQ3U052ZGRTNEJx?= =?utf-8?B?T3RPK1hMN1FOV3FPd2ZFRTRpdzFKSWg5UnJsMlBzZ2x4SUhlWk8rYkppR1Bj?= =?utf-8?B?V3p5Qi9JbWxQbWQwOXJnRTk1VkwxM1B2QjdUQ3d0OVZUQVZUUGZPOVBTK1VZ?= =?utf-8?B?bGMvYkdTcmQ5TXlDeXowbXpGM2lMTlU2R1pSOHRYbnZNREF2UVI0a1dVN0da?= =?utf-8?B?NFp3SX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Tenant-AuthSource: PA4PR04MB7790.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2023 06:39:13.9188 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0Goi72gu8lEZLqihBFlthUZgSbn3XE3O9+9wTn1A38p9lGwqwMjxBhoAxkuiChfXjXW7xiLAt8o3z3lrqGgPEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7489 X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 On 13.08.23 г. 13:45 ч., Borislav Petkov wrote: > From: "Borislav Petkov (AMD)" > > Skip the srso cmd line parsing which is not needed on Zen1/2 with SMT > disabled and with the proper microcode applied (latter should be the > case anyway) as those are not affected. > > Fixes: 5a15d8348881 ("x86/srso: Tie SBPB bit setting to microcode patch detection") > Signed-off-by: Borislav Petkov (AMD) > --- > arch/x86/kernel/cpu/bugs.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c > index d02f73c5339d..8959a1b9fb80 100644 > --- a/arch/x86/kernel/cpu/bugs.c > +++ b/arch/x86/kernel/cpu/bugs.c > @@ -2418,8 +2418,10 @@ static void __init srso_select_mitigation(void) > * IBPB microcode has been applied. > */ > if ((boot_cpu_data.x86 < 0x19) && > - (!cpu_smt_possible() || (cpu_smt_control == CPU_SMT_DISABLED))) > + (!cpu_smt_possible() || (cpu_smt_control == CPU_SMT_DISABLED))) { > setup_force_cpu_cap(X86_FEATURE_SRSO_NO); > + goto pred_cmd; Actually can't you simply return, given that zen1/2 never have the SBPB flag set? Only zen3/4 with the updated microcode? > + } > } > > if (retbleed_mitigation == RETBLEED_MITIGATION_IBPB) { > @@ -2696,6 +2698,9 @@ static ssize_t retbleed_show_state(char *buf) > > static ssize_t srso_show_state(char *buf) > { > + if (boot_cpu_has(X86_FEATURE_SRSO_NO)) > + return sysfs_emit(buf, "Not affected\n"); > + > return sysfs_emit(buf, "%s%s\n", > srso_strings[srso_mitigation], > (cpu_has_ibpb_brtype_microcode() ? "" : ", no microcode"));