From patchwork Thu Feb 29 14:23:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 208387 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp431365dyb; Thu, 29 Feb 2024 06:25:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCURPyPxY4k16N5t9CQZ1VyShjj+h5P/J2IBlx5zDRmGX4mEiVQVuQW65zJZb/a+1/HyqIsoeEWHxRFbNU1WKmS551nwRw== X-Google-Smtp-Source: AGHT+IHCLr7ugFahE86u0b5ENM9NqIrVrRalsH5eS4shuWG1ATpkMFSjTRu7kxR8cZTCP9Vr6tHJ X-Received: by 2002:aca:220e:0:b0:3c1:333e:6842 with SMTP id b14-20020aca220e000000b003c1333e6842mr2026573oic.49.1709216707045; Thu, 29 Feb 2024 06:25:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709216707; cv=pass; d=google.com; s=arc-20160816; b=DkHuv4K1cnRmWW3FZvNVMTmULNrUoNX72rky4oLed0I+DzypiQBWBKHQiNyg1GsLjY cMPMbiEAkQFmC8IRKyEVtl+YxP3HdjDjJ68fo5L2VhPiPPsryeAIs8AYpYVv3EKigaDh W9JYbrzDZYvy0/OoHX0siCEjx1BzSX0fWOglqhovHhCVV0/Y5VkdGj/SR4GgcfH+9fbK EeOrjCInaU23OIHaUoL7Gv5RaesVgc4IlxVqwqv7fpy3kOKehdONw4nq8ndxOqul74ay QYswDHqSlB1T/KXBQW9vIh1oxJfJjyJlRb9AJ3N01l1nBZwjEWquTa2YvE8liBN6ER3/ enyA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:subject:cc:to:from:dkim-signature :dkim-signature:message-id; bh=5zOS4RmiqmuxETrUeHDkk2a5VYE4kSbamD+YHfMNWQI=; fh=PG4pDnEpPgvD7rD3Usg/3IzySUyERYtwQcr+tbVLEzM=; b=vPtXEHFZ7JY2vAPewUUzENi8D9RzCn1BQtzK7NvmMZJnqVXU+acyEQJ9aJyp8e5H+i 6c2y5luO+gC8v/kbuNhcGfCzV9cB4Yd4sPCgJsUJEwIjwiShM1c4DazT+GBkZOyQUQmp ZdMmDyoKtVHNkCM6J5PCrWThTbWmewys6+ddDsAnyLzkBIhnfngTZkAKdW+CvCYG0wGi 0IW65cu1oJoil6GKG6qhHxF9oM3uSvI1seRkJqXqB+aVwUh+abKtZFZoCXO4W/nD2C01 +oeJky+gK/7CZbv0R3HaGYOadf1qsl8aLcMSCrF2bj0P0nApHS0fO7xHF6wBXKUG4vya RW0Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=gQxTa00y; 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-86833-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86833-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 f17-20020a056a0022d100b006e586e295a0si1408075pfj.218.2024.02.29.06.25.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 06:25:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86833-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=gQxTa00y; 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-86833-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86833-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 C9D9E286C32 for ; Thu, 29 Feb 2024 14:25:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D96DC13AA29; Thu, 29 Feb 2024 14:23:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="gQxTa00y"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="wht6X27n" 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 DAF4812E1CC for ; Thu, 29 Feb 2024 14:23:41 +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=1709216624; cv=none; b=hL+UlSINz/SRVByhQwbQLO0N6X24+O1B6ErlnXts+pjIMjIblSbJMTLkv2yk8a8Ef7e1omkwHkJr+8i2h/dC39Ycew0MXa4T9FPFBBVx7fZ4d6Jmj+bQ8M9WB29LnSJmBKKxN0E2yKxBm2ieCQb+qCNxgXtuZYeGbQ2Ab3Okhss= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709216624; c=relaxed/simple; bh=4gP+iCapKlXKlht2djclMxdp9+iBcME2VXu0sjNJfdY=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=TzTi13fwB0QnoqV3sHBqPCCE5pEDUvMtJGFmV4LSYWWehY3QIijt5D8/WvEYbkjOKI7VdhrnjA6gGgJwJkzU5skP3LgHmdo8V8UH2I6guh/XLR6heVxOiVT8mBEAJqBGKqeEtqsQa3RL8u6xlAfU3r8EFD7Kx0jGtwJbCyZpgiw= 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=gQxTa00y; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=wht6X27n; 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 Message-ID: <20240229142248.455616019@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1709216620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=5zOS4RmiqmuxETrUeHDkk2a5VYE4kSbamD+YHfMNWQI=; b=gQxTa00y5xXOnO+IsbeQpXwy0aF7+r804PplTpYmFwo3UCQHh2zhkCjgDXY9ylKgsECxD+ bRq471S+WVE8Gbmhz3YjVkvMxTUPpgkde/anMmbl4FQUmNOCZRp0nvPx8nxK58V5LYTfS2 W6CD4MnuV/99WwLbvwOEM8CQPVvmpcFWjR6JLZtJp31pQy5GscAJAzn/dNvHbBOkzgtB3U 1yTa7uWypi16DwEEs0E8UCQfGPeFVJuei7VaP9Hc0D3cu4Ox7UfH6GP1jcKCGcJGtNF/oP MHs9GBcsMgnAr6AkZyjOMCag1poyYi9zdsfAsfi//A7vSmu9sqUikTQQLAR77Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1709216620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=5zOS4RmiqmuxETrUeHDkk2a5VYE4kSbamD+YHfMNWQI=; b=wht6X27nW2dY56wOgfMT4WpRGpikBJZUKKltKmZUE7iUq32/vSKbWZii1rHIT3siqAVr+r i1he2N7vAGxefxCQ== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Steven Rostedt , "Paul E. McKenney" Subject: [patch 4/6] x86/idle: Cleanup idle_setup() References: <20240229141407.283316443@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Thu, 29 Feb 2024 15:23:40 +0100 (CET) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792243617597872433 X-GMAIL-MSGID: 1792243617597872433 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 --- arch/x86/kernel/process.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -857,8 +857,8 @@ static int prefer_mwait_c1_over_halt(con { 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 */ @@ -975,24 +975,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; }