public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: x86@kernel.org, Steven Rostedt <rostedt@goodmis.org>,
	"Paul E. McKenney" <paulmck@kernel.org>
Subject: [patch 4/6] x86/idle: Cleanup idle_setup()
Date: Thu, 29 Feb 2024 15:23:40 +0100 (CET)	[thread overview]
Message-ID: <20240229142248.455616019@linutronix.de> (raw)
In-Reply-To: 20240229141407.283316443@linutronix.de

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 <tglx@linutronix.de>
---
 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;
 }


  parent reply	other threads:[~2024-02-29 14:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 14:23 [patch 0/6] x86/idle: Cure RCU violations and cleanups Thomas Gleixner
2024-02-29 14:23 ` [patch 1/6] sched/idle: Conditionally handle tick broadcast in default_idle_call() Thomas Gleixner
2024-03-01 20:48   ` [tip: x86/core] " tip-bot2 for Thomas Gleixner
2024-02-29 14:23 ` [patch 2/6] x86/idle: Sanitize X86_BUG_AMD_E400 handling Thomas Gleixner
2024-03-01 12:33   ` Thomas Gleixner
2024-03-01 20:48     ` [tip: x86/core] " tip-bot2 for Thomas Gleixner
2024-03-04 16:51     ` tip-bot2 for Thomas Gleixner
2024-02-29 14:23 ` [patch 3/6] x86/idle: Clean up idle selection Thomas Gleixner
2024-03-01 20:48   ` [tip: x86/core] " tip-bot2 for Thomas Gleixner
2024-03-04 16:51   ` tip-bot2 for Thomas Gleixner
2024-02-29 14:23 ` Thomas Gleixner [this message]
2024-03-01 20:48   ` [tip: x86/core] x86/idle: Cleanup idle_setup() tip-bot2 for Thomas Gleixner
2024-03-04 16:51   ` tip-bot2 for Thomas Gleixner
2024-02-29 14:23 ` [patch 5/6] x86/idle: Let prefer_mwait_c1_over_halt() return bool Thomas Gleixner
2024-03-01 20:48   ` [tip: x86/core] " tip-bot2 for Thomas Gleixner
2024-03-04 16:51   ` tip-bot2 for Thomas Gleixner
2024-02-29 14:23 ` [patch 6/6] x86/idle: Select idle routine only once Thomas Gleixner
2024-03-01  8:14   ` Thomas Gleixner
2024-03-01 11:33     ` Thomas Gleixner
2024-03-01 20:48       ` [tip: x86/core] " tip-bot2 for Thomas Gleixner
2024-03-04 16:51       ` tip-bot2 for Thomas Gleixner
2024-03-01 18:41 ` [patch 0/6] x86/idle: Cure RCU violations and cleanups Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240229142248.455616019@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox