From patchwork Wed Jan 10 10:09:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 186759 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp694884dyi; Wed, 10 Jan 2024 02:14:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IEnN6yisoqALjgE3lFrW5wbNsB8r6dUQf2O+U3eACd08aoZfU62b4pCtBk3z4LrLXacFrTp X-Received: by 2002:a05:6a00:1c90:b0:6d5:a679:e8f4 with SMTP id y16-20020a056a001c9000b006d5a679e8f4mr726869pfw.57.1704881651977; Wed, 10 Jan 2024 02:14:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704881651; cv=none; d=google.com; s=arc-20160816; b=F2XYOsqf91xT2RGv+auo+qVWZHUPHbG7yBf/3vvPoDAOJoRVjOF0S8FCuNKQwrTew7 /ReJG+oe2UW0tQ8CO60w6SHbEEWTtUzoJzQoCTYVfo6xNIP2rQDVMCAk7XCWoFDLYZNq /dH3GVMyjXJw7EDsAjBvtDSc/BRzHRsOhNw1oonWfpDhgsn/wHDtGZLquEl4EPMDlfST E9e0jT0rk7X7i6qU99ji4SDluRe7oeovq9CZitd4oV8MtFTFiOgAur5ckTIUPHITX3ly pvlYr9rxXWZnIeJ0FFg1mv2sg9w+OwC9TDrINqxKII25799P5iyN6BVMo/sdobL32Xdp MAYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=3TIgW4R6YAM5Po2GV3pibFu2xpbNoKGCJeRWB/9sD/E=; fh=w9LP7x4fMDC4MQwSw7dBmiHv9ezjNVwOsQKnG8RpbJ8=; b=HmNHuvJ9q5Yu2kIMK7oMysXFBmWMqrfLUnnA4FBT++3pyybHFPdq9qGHDI4ZLsCleg KNFjRd5EzNULK5UFwl6Tf8YycmSQmGVOlHMQHDCO4GHbw92YmuxtknvPA/9hTRgG2dIk xedXMh5v9NTce0ODnWM7lTTtO7KUep9XQmOngUBnomg6/PS6pX9N3z3idetsA/ZXoBhI eqtPKtdIH/Du1Sj7elOifIka402Ri+UVPNCiHAeNxeWsTl/ChEKyO3qjQfNjQnlrGsk0 lIBQBTf3FdtZdO9FAbUEz3bTczkazUCdGcDZU9EzakgrSrU/fmDcu7C/iEFU/mbqO7zT /G5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=W54yrdbi; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel+bounces-21949-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21949-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id bd5-20020a656e05000000b005c658bf30a8si3526293pgb.302.2024.01.10.02.14.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 02:14:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-21949-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=W54yrdbi; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel+bounces-21949-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21949-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C8B0BB261A5 for ; Wed, 10 Jan 2024 10:12:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8412646444; Wed, 10 Jan 2024 10:10:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="W54yrdbi"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="LkG2atyT" 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 97FDC405FF; Wed, 10 Jan 2024 10:09:57 +0000 (UTC) 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 Date: Wed, 10 Jan 2024 10:09:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1704881396; 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=3TIgW4R6YAM5Po2GV3pibFu2xpbNoKGCJeRWB/9sD/E=; b=W54yrdbiyvXoYWmUVGcN1faSFY4UWEe7oJBP1U1lJeeQ0IqeCOeummWASOEm+AnsZW3KGc wSpkWsJao+XQ8YrSXWIu6LwNZTzRIUaFltY61t/fXZJR96KgFNCOwge9dwE3bkh5nGBgFz NX1YWZwcnGSds3qg3kKnkogaWM87m6/k6Jwr5DsP6M2d2QtimPOv5AzTHoDGhIzAYQqzTw JairGqpiL0cu5kAE/fPAfRLhYuNr44kQHa35OdDNlkxOHdrgMw3hu36yMxMuNbsQkaPQA7 LKD/YQohK2zAVSpKLGWigHc+sD+jK2Zu2ZcvcPXQM53svR8sVSrSjpBDRy5cgg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1704881396; 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=3TIgW4R6YAM5Po2GV3pibFu2xpbNoKGCJeRWB/9sD/E=; b=LkG2atyTxqPl6qeJh0GBNlIBKlp03/QRh1zomBmldzdEYIFLrxVf5JBYaEj4BfZkq8ddJG 8aZx+NLspSkP+UCw== From: "tip-bot2 for Breno Leitao" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/bugs] x86/bugs: Rename CONFIG_GDS_FORCE_MITIGATION => CONFIG_MITIGATION_GDS_FORCE Cc: Josh Poimboeuf , Breno Leitao , Ingo Molnar , Linus Torvalds , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231121160740.1249350-2-leitao@debian.org> References: <20231121160740.1249350-2-leitao@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170488139531.398.13211930159092959781.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787697983235764269 X-GMAIL-MSGID: 1787697983235764269 The following commit has been merged into the x86/bugs branch of tip: Commit-ID: be83e809ca67bca98fde97ad6b9344237963220b Gitweb: https://git.kernel.org/tip/be83e809ca67bca98fde97ad6b9344237963220b Author: Breno Leitao AuthorDate: Tue, 21 Nov 2023 08:07:28 -08:00 Committer: Ingo Molnar CommitterDate: Wed, 10 Jan 2024 10:43:14 +01:00 x86/bugs: Rename CONFIG_GDS_FORCE_MITIGATION => CONFIG_MITIGATION_GDS_FORCE So the CPU mitigations Kconfig entries - there's 10 meanwhile - are named in a historically idiosyncratic and hence rather inconsistent fashion and have become hard to relate with each other over the years: https://lore.kernel.org/lkml/20231011044252.42bplzjsam3qsasz@treble/ When they were introduced we never expected that we'd eventually have about a dozen of them, and that more organization would be useful, especially for Linux distributions that want to enable them in an informed fashion, and want to make sure all mitigations are configured as expected. For example, the current CONFIG_SPECULATION_MITIGATIONS namespace is only halfway populated, where some mitigations have entries in Kconfig, and they could be modified, while others mitigations do not have Kconfig entries, and can not be controlled at build time. Fine-grained control over these Kconfig entries can help in a number of ways: 1) Users can choose and pick only mitigations that are important for their workloads. 2) Users and developers can choose to disable mitigations that mangle the assembly code generation, making it hard to read. 3) Separate Kconfigs for just source code readability, so that we see *which* butt-ugly piece of crap code is for what reason... In most cases, if a mitigation is disabled at compilation time, it can still be enabled at runtime using kernel command line arguments. This is the first patch of an initial series that renames various mitigation related Kconfig options, unifying them under a single CONFIG_MITIGATION_* namespace: CONFIG_GDS_FORCE_MITIGATION => CONFIG_MITIGATION_GDS_FORCE CONFIG_CPU_IBPB_ENTRY => CONFIG_MITIGATION_IBPB_ENTRY CONFIG_CALL_DEPTH_TRACKING => CONFIG_MITIGATION_CALL_DEPTH_TRACKING CONFIG_PAGE_TABLE_ISOLATION => CONFIG_MITIGATION_PAGE_TABLE_ISOLATION CONFIG_RETPOLINE => CONFIG_MITIGATION_RETPOLINE CONFIG_SLS => CONFIG_MITIGATION_SLS CONFIG_CPU_UNRET_ENTRY => CONFIG_MITIGATION_UNRET_ENTRY CONFIG_CPU_IBRS_ENTRY => CONFIG_MITIGATION_IBRS_ENTRY CONFIG_CPU_SRSO => CONFIG_MITIGATION_SRSO CONFIG_RETHUNK => CONFIG_MITIGATION_RETHUNK Implement step 1/10 of the namespace unification of CPU mitigations related Kconfig options and rename CONFIG_GDS_FORCE_MITIGATION to CONFIG_MITIGATION_GDS_FORCE. [ mingo: Rewrote changelog for clarity. ] Suggested-by: Josh Poimboeuf Signed-off-by: Breno Leitao Signed-off-by: Ingo Molnar Acked-by: Josh Poimboeuf Cc: Linus Torvalds Link: https://lore.kernel.org/r/20231121160740.1249350-2-leitao@debian.org --- arch/x86/Kconfig | 2 +- arch/x86/kernel/cpu/bugs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 53f2e77..1dba33a 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2587,7 +2587,7 @@ config SLS against straight line speculation. The kernel image might be slightly larger. -config GDS_FORCE_MITIGATION +config MITIGATION_GDS_FORCE bool "Force GDS Mitigation" depends on CPU_SUP_INTEL default n diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index bb0ab84..3c7e27b 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -671,7 +671,7 @@ enum gds_mitigations { GDS_MITIGATION_HYPERVISOR, }; -#if IS_ENABLED(CONFIG_GDS_FORCE_MITIGATION) +#if IS_ENABLED(CONFIG_MITIGATION_GDS_FORCE) static enum gds_mitigations gds_mitigation __ro_after_init = GDS_MITIGATION_FORCE; #else static enum gds_mitigations gds_mitigation __ro_after_init = GDS_MITIGATION_FULL;