From: Dave Hansen <dave.hansen@intel.com>
To: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>, 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
Subject: Re: [PATCH v3 3/3] intel_idle: Provide enter_dead() handler for SRF
Date: Fri, 8 Nov 2024 08:21:24 -0800 [thread overview]
Message-ID: <b6ab357c-1562-4035-ad3a-2159d2c8c1fa@intel.com> (raw)
In-Reply-To: <20241108122909.763663-4-patryk.wlazlyn@linux.intel.com>
On 11/8/24 04:29, Patryk Wlazlyn wrote:
> 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.
This series has said multiple times how the old algorithm is wrong. But
it never actually _fixed_ the bad algorithm, only worked around it.
Does mwait_play_dead() itself need to get fixed?
> Define the enter_dead() handler for SRF.
This effectively gets the mwait hints from ______ instead of using the
calculation in mwait_play_dead().
> diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
> index 9aab7abc2ae9..bd67959e5e8b 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"
>
> @@ -221,6 +222,17 @@ static __cpuidle int intel_idle_s2idle(struct cpuidle_device *dev,
> return 0;
> }
>
> +static __cpuidle int 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);
> +
> + /* Retruns only in case of an error. */
^ returns?
> + return mwait_play_dead_with_hint(eax);
> +}
> +
> /*
> * States are indexed by the cstate number,
> * which is also the index into the MWAIT hint array.
> @@ -1303,6 +1315,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",
> @@ -1311,6 +1324,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",
> @@ -1319,6 +1333,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",
> @@ -1327,6 +1342,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 }
next prev parent reply other threads:[~2024-11-08 16:21 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-08 12:29 [PATCH v3 0/3] SRF: Fix offline CPU preventing pc6 entry Patryk Wlazlyn
2024-11-08 12:29 ` [PATCH v3 1/3] x86/smp: Allow calling mwait_play_dead with arbitrary hint Patryk Wlazlyn
2024-11-08 16:03 ` Dave Hansen
2024-11-12 10:54 ` Patryk Wlazlyn
2024-11-08 12:29 ` [PATCH v3 2/3] x86/smp native_play_dead: Prefer cpuidle_play_dead() over mwait_play_dead() Patryk Wlazlyn
2024-11-08 16:14 ` Dave Hansen
2024-11-12 10:55 ` Patryk Wlazlyn
2024-11-12 11:47 ` Peter Zijlstra
2024-11-12 12:03 ` Rafael J. Wysocki
2024-11-12 12:18 ` Peter Zijlstra
2024-11-12 12:30 ` Rafael J. Wysocki
2024-11-12 12:38 ` Rafael J. Wysocki
2024-11-12 13:49 ` Peter Zijlstra
2024-11-12 14:56 ` Rafael J. Wysocki
2024-11-12 15:08 ` Peter Zijlstra
2024-11-12 16:24 ` Rafael J. Wysocki
2024-11-12 12:44 ` Artem Bityutskiy
2024-11-12 14:01 ` Peter Zijlstra
2024-11-14 12:03 ` Peter Zijlstra
2024-11-15 1:21 ` Thomas Gleixner
2024-11-15 10:07 ` Peter Zijlstra
2024-11-15 15:37 ` Thomas Gleixner
2024-11-12 13:23 ` Rafael J. Wysocki
2024-11-12 14:56 ` Peter Zijlstra
2024-11-12 15:00 ` Rafael J. Wysocki
2024-11-13 11:41 ` Gautham R. Shenoy
2024-11-13 16:14 ` Dave Hansen
2024-11-14 5:06 ` Gautham R. Shenoy
2024-11-13 16:22 ` Peter Zijlstra
2024-11-13 16:27 ` Wysocki, Rafael J
2024-11-14 11:58 ` Rafael J. Wysocki
2024-11-14 12:17 ` Peter Zijlstra
2024-11-14 17:36 ` Gautham R. Shenoy
2024-11-14 17:58 ` Rafael J. Wysocki
2024-11-14 11:58 ` Peter Zijlstra
2024-11-14 17:24 ` Gautham R. Shenoy
2024-11-15 10:11 ` Peter Zijlstra
2024-11-25 5:45 ` Gautham R. Shenoy
2024-11-08 12:29 ` [PATCH v3 3/3] intel_idle: Provide enter_dead() handler for SRF Patryk Wlazlyn
2024-11-08 16:21 ` Dave Hansen [this message]
2024-11-12 10:57 ` Patryk Wlazlyn
2024-11-12 11:28 ` Rafael J. Wysocki
2024-11-12 16:07 ` Dave Hansen
2024-11-12 19:17 ` Thomas Gleixner
2024-11-12 19:43 ` Rafael J. Wysocki
2024-11-08 22:12 ` kernel test robot
2024-11-08 16:22 ` [PATCH v3 0/3] SRF: Fix offline CPU preventing pc6 entry Dave Hansen
2024-11-12 11:45 ` Peter Zijlstra
2024-11-12 15:43 ` Patryk Wlazlyn
2024-11-13 1:19 ` Thomas Gleixner
2024-11-14 17:13 ` 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=b6ab357c-1562-4035-ad3a-2159d2c8c1fa@intel.com \
--to=dave.hansen@intel.com \
--cc=artem.bityutskiy@linux.intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=patryk.wlazlyn@linux.intel.com \
--cc=rafael.j.wysocki@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
Powered by JetHome