From patchwork Fri Mar 1 20:48:41 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: 209084 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp146444dyc; Fri, 1 Mar 2024 12:49:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWiPoLRVT35loZxyGEGYC5Z8EnWOJXXn3pEm+chZsIl75tlMwe+fZZnlzzqgesfCq5z8XFlykmtI7nnGJFfAMGEIXlCxw== X-Google-Smtp-Source: AGHT+IHz/rc/hX9E87J+PBYdVb7pfbkrljOyzMC4Vp1zh4M1FFVes0X/o2GfLpa4eaM/+aTbKYFK X-Received: by 2002:a05:6a00:1915:b0:6e5:75cd:eff0 with SMTP id y21-20020a056a00191500b006e575cdeff0mr3045844pfi.31.1709326192179; Fri, 01 Mar 2024 12:49:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709326192; cv=pass; d=google.com; s=arc-20160816; b=JaM45ogvfcFQjZa8z9hCMYohzWfaUw4Zr5H5y5XZ+MmTckcvrNBsq9OOq7m9RADC5R Bjg+mc01uI50ISYKwPlbYobFUXRyzI0ID1yjUeygIVBTS4ul2wVUxeQDy9dEtXxfP9Gv qMTcmbCDlj+u6iLNA3yNgqSZMaSPVLKqik8K7Fx+cXoWXbLM3CSrb5417fAvjLIHkWfx L9qQT7QIeQSHQsqOjc6B9tKPty9NOrGKailO+evHFK5yFEaDUFUXmK+1zCWIrSUC6/k7 lVTn3o6nnzQ/u9I2038IKv2+GUM9o9/e99GW2jVQ4Y1CGb8JEWtg6oTencozSB/M3WjH rX6Q== ARC-Message-Signature: i=2; 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=Ui3SYieBqqn1j62erXEiR8w6UOpmPbPxN3xpDtByAec=; fh=LWlv3U+xZ3+vQt4tlJRIlKl5VzN7iFjjE/bzRmlxKDA=; b=Ijosn8M3zTLTB0mNEmNTS4bROo5kU/UZvSEzfFXRjcuh7+V81OCKkHtLb2B7gdsmOe 4f1FRrzUBS/V/Jxg5CRzbQjf+5dme7NNfHr8yGnUICjY8SeS6B+nq7g+6IDiKofo/L/J vMHr36jTTIW9qeybM4hXHTNTIgOPy5mygidSlaK5ufBIRrrI5hbT/9CViVRc8sVMNBaL pc0oWQPKZ2i1RlqIBu27YhcHrfuywf9j2D8BJqOtM1Tqcr7qRgZkk/i/AwvedVLgL1Gz yAg1bsFNr74RATFDPsODH3i6YrDUKPeMPwe+0+GF59tGAn0/7XaxQ4WkJPkeN2NEBzNH O/XA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=3Cr4tHB9; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-89117-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89117-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g25-20020aa78759000000b006e5002a2fd0si4051071pfo.214.2024.03.01.12.49.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 12:49:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89117-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=3Cr4tHB9; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-89117-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89117-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F0D0F28FEB9 for ; Fri, 1 Mar 2024 20:49:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 12DF95337E; Fri, 1 Mar 2024 20:48:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="3Cr4tHB9"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="21GV2Gwi" 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 0A5EA535D8; Fri, 1 Mar 2024 20:48:46 +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=1709326129; cv=none; b=AfKDetijrQDzjVLxksfPjkIxOuH13SOML5J5c5T6JYDO0ageyQn2IisJRKIXukRI8g1Ux5ZxYGOSyZiEOyZQ2KthiofbYWjnn5wnYzquKGuZVn7iDnlqoskmF0VMMv3s8h7/UBNMzi5i8dPhoPkyCuz4ZMh9LVVOLRc6siz8RvU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709326129; c=relaxed/simple; bh=/OxaSFUwbcZjdgz+qP4MfHULJH3O18mktXxiQSh+XM8=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=WTzuKuNuxSnc+nfCcD0vrwh9x47VUKp3w6f+AkNyPnGDxWaR9ZMkFVWBvoh1g6tnTmtPke+G8u7dLULdlk/HUX3FbxWIXPDyKJ1aiKXrjSdmk/W2WdeL5bP0R3fW7bLy14kWjpNWiDGIhoN9eNvh8B0yr7kSywL3m3V1Ux7U2sM= 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=3Cr4tHB9; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=21GV2Gwi; 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 Date: Fri, 01 Mar 2024 20:48:41 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1709326122; 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=Ui3SYieBqqn1j62erXEiR8w6UOpmPbPxN3xpDtByAec=; b=3Cr4tHB9Hebi0Zn/qsazggdb+uX5Js+pXFWxBmWwWPoKQG8JWmAruDtA+C46Vvt0vBGif4 kccw/YWUafw1SuUPSmtZZjUdh9xzw4Hs5dEL1MxlYTgPjFmcd7LgAMrSoKYinqpQWRmDw2 p8AyqkeL/CzX5rvcW0CGjtERZJGt0mOxSTWgU4SXqtJiThvtG1yhrykrLg57dh2YuKceQi DcYRfTbq0OiKbKfKEqKYLJ5Cpec2NHfq3cKHdLmrLX6J64kBzp/ZxqALMJ82G7T2j4g5md xl13dINkgxsuFDdunpFxCUTgFtN/zLfRYqIY7oX7GZAsqKNEnwh+u/fperJjDw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1709326122; 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=Ui3SYieBqqn1j62erXEiR8w6UOpmPbPxN3xpDtByAec=; b=21GV2GwiUo162b/A6Y7eW06c75dWTm+QzqMzvqdYUgud2eJM2Cv/puK0gbdEXqSfRk/Xxu xNdvt7fHqU7RQRCA== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/core] x86/idle: Cleanup idle_setup() Cc: Thomas Gleixner , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240229142248.455616019@linutronix.de> References: <20240229142248.455616019@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170932612188.398.908153831570095821.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: 1792243617597872433 X-GMAIL-MSGID: 1792358421677193815 The following commit has been merged into the x86/core branch of tip: Commit-ID: 695f90619cf785f8a13cbf21bbfddae103542fdf Gitweb: https://git.kernel.org/tip/695f90619cf785f8a13cbf21bbfddae103542fdf Author: Thomas Gleixner AuthorDate: Thu, 29 Feb 2024 15:23:40 +01:00 Committer: Borislav Petkov (AMD) CommitterDate: Fri, 01 Mar 2024 21:33:12 +01:00 x86/idle: Cleanup idle_setup() Updating the static call for x86_idle() from idle_setup() is counter-intuitive. Let select_idle_routine() handle it like the other idle choices, which allows to simplify the idle selection later on. While at it rewrite comments and return a proper error code and not -1. Signed-off-by: Thomas Gleixner Signed-off-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/20240229142248.455616019@linutronix.de --- arch/x86/kernel/process.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index b6512f7..678d5cf 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -857,8 +857,8 @@ static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c) { u32 eax, ebx, ecx, edx; - /* User has disallowed the use of MWAIT. Fallback to HALT */ - if (boot_option_idle_override == IDLE_NOMWAIT) + /* If override is enforced on the command line, fall back to HALT. */ + if (boot_option_idle_override != IDLE_NO_OVERRIDE) return 0; /* MWAIT is not supported on this platform. Fallback to HALT */ @@ -976,24 +976,14 @@ static int __init idle_setup(char *str) boot_option_idle_override = IDLE_POLL; cpu_idle_poll_ctrl(true); } else if (!strcmp(str, "halt")) { - /* - * When the boot option of idle=halt is added, halt is - * forced to be used for CPU idle. In such case CPU C2/C3 - * won't be used again. - * To continue to load the CPU idle driver, don't touch - * the boot_option_idle_override. - */ - static_call_update(x86_idle, default_idle); + /* 'idle=halt' HALT for idle. C-states are disabled. */ boot_option_idle_override = IDLE_HALT; } else if (!strcmp(str, "nomwait")) { - /* - * If the boot option of "idle=nomwait" is added, - * it means that mwait will be disabled for CPU C1/C2/C3 - * states. - */ + /* 'idle=nomwait' disables MWAIT for idle */ boot_option_idle_override = IDLE_NOMWAIT; - } else - return -1; + } else { + return -EINVAL; + } return 0; }