From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: x86 Maintainers <x86@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux PM <linux-pm@vger.kernel.org>, Len Brown <lenb@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Borislav Petkov <bp@suse.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Artem Bityutskiy <artem.bityutskiy@linux.intel.com>,
"Gautham R. Shenoy" <gautham.shenoy@amd.com>,
Ingo Molnar <mingo@redhat.com>,
Todd Brandt <todd.e.brandt@linux.intel.com>
Subject: [PATCH v1 2/2] x86/smp: Prefer cpuidle_play_dead() to mwait_play_dead_cpuid_hint()
Date: Wed, 28 May 2025 14:54:49 +0200 [thread overview]
Message-ID: <3633769.iIbC2pHGDl@rjwysocki.net> (raw)
In-Reply-To: <2006806.PYKUYFuaPT@rjwysocki.net>
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Currently, mwait_play_dead_cpuid_hint() looks up the MWAIT hint of the
deepest idle state by inspecting CPUID leaf 0x05 with the assumption
that, if the number of sub-states for a given major C-state is nonzero,
those sub-states are always represented by consecutive numbers starting
from 0. This assumption is not based on the documented platform behavior
and in fact it is not met on recent Intel platforms (eg. Sierra Forest).
For this reason, it is better to let the cpuidle driver for the given
platform put CPUs going offline into appropriate idle state and only
if that fails, fall back to mwait_play_dead_cpuid_hint(), which may
still be the next best "play dead" variant if cpuidle is not available.
For example, when "nosmt" is passed to the kernel in the command line,
SMT siblings are disabled early, before cpuidle gets ready, but they
need to be put into sufficiently deep idle states to allow the whole
processor to reach deep package idle states, like PC10, later on.
Tested-by: Todd Brandt <todd.e.brandt@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
arch/x86/kernel/smpboot.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1377,9 +1377,10 @@
play_dead_common();
tboot_shutdown(TB_SHUTDOWN_WFS);
+ /* Each call in the following sequence returns only on errors. */
+ cpuidle_play_dead();
mwait_play_dead_cpuid_hint();
- if (cpuidle_play_dead())
- hlt_play_dead();
+ hlt_play_dead();
}
#else /* ... !CONFIG_HOTPLUG_CPU */
next prev parent reply other threads:[~2025-05-28 13:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-28 12:53 [PATCH v1 0/2] x86/smp: Fix power regression introduced by commit 96040f7273e2 Rafael J. Wysocki
2025-05-28 12:53 ` [PATCH v1 1/2] Revert "x86/smp: Eliminate mwait_play_dead_cpuid_hint()" Rafael J. Wysocki
2025-05-28 12:54 ` Rafael J. Wysocki [this message]
2025-05-28 13:17 ` [PATCH v1 0/2] x86/smp: Fix power regression introduced by commit 96040f7273e2 Peter Zijlstra
2025-05-28 13:20 ` Rafael J. Wysocki
2025-05-28 13:38 ` Peter Zijlstra
2025-05-28 14:25 ` Rafael J. Wysocki
2025-05-28 16:05 ` Peter Zijlstra
2025-05-28 17:09 ` Rafael J. Wysocki
2025-05-29 8:53 ` Peter Zijlstra
2025-05-29 9:38 ` Rafael J. Wysocki
2025-05-30 8:07 ` Peter Zijlstra
2025-05-30 9:18 ` Rafael J. Wysocki
2025-05-30 9:27 ` Rafael J. Wysocki
2025-05-30 16:59 ` Rafael J. Wysocki
2025-05-30 17:55 ` Rafael J. Wysocki
2025-05-29 13:40 ` [PATCH v2] Revert "x86/smp: Eliminate mwait_play_dead_cpuid_hint()" Rafael J. Wysocki
2025-05-29 14:25 ` Dave Hansen
2025-05-29 15:39 ` Rafael J. Wysocki
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=3633769.iIbC2pHGDl@rjwysocki.net \
--to=rjw@rjwysocki.net \
--cc=artem.bityutskiy@linux.intel.com \
--cc=bp@suse.de \
--cc=dave.hansen@linux.intel.com \
--cc=gautham.shenoy@amd.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=todd.e.brandt@linux.intel.com \
--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