From: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
rafael.j.wysocki@intel.com, len.brown@intel.com,
artem.bityutskiy@linux.intel.com, dave.hansen@linux.intel.com,
patryk.wlazlyn@linux.intel.com, peterz@infradead.org,
tglx@linutronix.de, gautham.shenoy@amd.com
Subject: [RFC PATCH v4 6/8] intel_idle: Provide enter_dead() handler for SRF
Date: Mon, 25 Nov 2024 14:20:26 +0100 [thread overview]
Message-ID: <20241125132029.7241-7-patryk.wlazlyn@linux.intel.com> (raw)
In-Reply-To: <20241125132029.7241-1-patryk.wlazlyn@linux.intel.com>
Intel's Sierra Forest report two C6 substates in cpuid leaf 5:
C6S (hint 0x22)
C6SP (hint 0x23)
Hints 0x20 and 0x21 are skipped entirely, causing the generic
implementation in mwait_play_dead() to compute the wrong hint, when
looking for the deepest cstate. As a result, package with an offlined
CPU can never reach PC6.
Define the enter_dead() handler for SRF.
Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
---
drivers/idle/intel_idle.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index ac4d8faa3886..c2ca01e74add 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -56,6 +56,7 @@
#include <asm/mwait.h>
#include <asm/spec-ctrl.h>
#include <asm/fpu/api.h>
+#include <asm/smp.h>
#define INTEL_IDLE_VERSION "0.5.1"
@@ -227,6 +228,16 @@ static __cpuidle int intel_idle_s2idle(struct cpuidle_device *dev,
return 0;
}
+static __cpuidle void intel_idle_enter_dead(struct cpuidle_device *dev,
+ int index)
+{
+ struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
+ struct cpuidle_state *state = &drv->states[index];
+ unsigned long eax = flg2MWAIT(state->flags);
+
+ mwait_play_dead_with_hint(eax);
+}
+
/*
* States are indexed by the cstate number,
* which is also the index into the MWAIT hint array.
@@ -1391,6 +1402,7 @@ static struct cpuidle_state srf_cstates[] __initdata = {
.exit_latency = 1,
.target_residency = 1,
.enter = &intel_idle,
+ .enter_dead = &intel_idle_enter_dead,
.enter_s2idle = intel_idle_s2idle, },
{
.name = "C1E",
@@ -1399,6 +1411,7 @@ static struct cpuidle_state srf_cstates[] __initdata = {
.exit_latency = 2,
.target_residency = 10,
.enter = &intel_idle,
+ .enter_dead = &intel_idle_enter_dead,
.enter_s2idle = intel_idle_s2idle, },
{
.name = "C6S",
@@ -1408,6 +1421,7 @@ static struct cpuidle_state srf_cstates[] __initdata = {
.exit_latency = 270,
.target_residency = 700,
.enter = &intel_idle,
+ .enter_dead = &intel_idle_enter_dead,
.enter_s2idle = intel_idle_s2idle, },
{
.name = "C6SP",
@@ -1417,6 +1431,7 @@ static struct cpuidle_state srf_cstates[] __initdata = {
.exit_latency = 310,
.target_residency = 900,
.enter = &intel_idle,
+ .enter_dead = &intel_idle_enter_dead,
.enter_s2idle = intel_idle_s2idle, },
{
.enter = NULL }
--
2.47.0
next prev parent reply other threads:[~2024-11-25 13:21 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-25 13:20 [RFC PATCH v4 0/8] SRF: Fix offline CPU preventing pc6 entry Patryk Wlazlyn
2024-11-25 13:20 ` [RFC PATCH v4 1/8] cpuidle: Do not return from cpuidle_play_dead() on callback failures Patryk Wlazlyn
2024-11-25 13:26 ` Rafael J. Wysocki
2024-11-25 14:36 ` Patryk Wlazlyn
2024-11-25 13:20 ` [RFC PATCH v4 2/8] cpuidle: Change :enter_dead() driver callback return type to void Patryk Wlazlyn
2024-11-25 13:20 ` [RFC PATCH v4 3/8] ACPI: processor_idle: Use acpi_idle_play_dead() for all C-states Patryk Wlazlyn
2024-11-25 13:24 ` Rafael J. Wysocki
2024-11-25 14:39 ` Patryk Wlazlyn
2024-11-25 14:36 ` Gautham R. Shenoy
2024-11-25 13:20 ` [RFC PATCH v4 4/8] x86/smp: Allow calling mwait_play_dead with arbitrary hint Patryk Wlazlyn
2024-11-25 14:39 ` Rafael J. Wysocki
2024-11-26 11:36 ` Patryk Wlazlyn
2024-11-26 11:45 ` Rafael J. Wysocki
2024-11-25 13:20 ` [RFC PATCH v4 5/8] x86/smp native_play_dead: Prefer cpuidle_play_dead() over mwait_play_dead() Patryk Wlazlyn
2024-11-25 13:45 ` Peter Zijlstra
2024-11-25 13:56 ` Rafael J. Wysocki
2024-11-25 14:43 ` Patryk Wlazlyn
2024-11-25 14:48 ` Rafael J. Wysocki
2024-11-26 11:56 ` Patryk Wlazlyn
2024-11-26 12:04 ` Rafael J. Wysocki
2024-11-26 13:10 ` Patryk Wlazlyn
2024-11-26 13:38 ` Rafael J. Wysocki
2024-11-25 13:20 ` Patryk Wlazlyn [this message]
2024-11-25 13:44 ` [RFC PATCH v4 6/8] intel_idle: Provide enter_dead() handler for SRF Rafael J. Wysocki
2024-11-25 14:48 ` Patryk Wlazlyn
2024-11-25 14:50 ` Rafael J. Wysocki
2024-11-25 13:53 ` Peter Zijlstra
2024-11-25 13:58 ` Rafael J. Wysocki
2024-11-25 14:12 ` Peter Zijlstra
2024-11-25 14:19 ` Rafael J. Wysocki
2024-11-25 13:20 ` [RFC PATCH v4 7/8] acpi_idle: Add FFH cstate handling Patryk Wlazlyn
2024-11-25 13:41 ` Rafael J. Wysocki
2024-11-25 14:00 ` Rafael J. Wysocki
2024-11-25 15:14 ` Gautham R. Shenoy
2024-11-26 12:03 ` Patryk Wlazlyn
2024-11-25 13:20 ` [RFC PATCH v4 8/8] acpi_idle: Disallow play_dead with FFH cstate on AMD platforms Patryk Wlazlyn
2024-11-25 13:46 ` Rafael J. Wysocki
2024-11-25 13:54 ` Peter Zijlstra
2024-11-25 14:56 ` Patryk Wlazlyn
2024-11-25 15:17 ` Gautham R. Shenoy
2024-11-25 15:15 ` Gautham R. Shenoy
2024-11-26 12:05 ` Patryk Wlazlyn
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=20241125132029.7241-7-patryk.wlazlyn@linux.intel.com \
--to=patryk.wlazlyn@linux.intel.com \
--cc=artem.bityutskiy@linux.intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=gautham.shenoy@amd.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rafael.j.wysocki@intel.com \
--cc=tglx@linutronix.de \
--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