* [PATCH v5 0/3] SRF: Fix offline CPU preventing pc6 entry
@ 2024-11-26 20:15 Patryk Wlazlyn
2024-11-26 20:15 ` [PATCH v5 1/3] x86/smp: Allow calling mwait_play_dead with an arbitrary hint Patryk Wlazlyn
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Patryk Wlazlyn @ 2024-11-26 20:15 UTC (permalink / raw)
To: x86
Cc: linux-kernel, linux-pm, rafael.j.wysocki, peterz, dave.hansen,
gautham.shenoy, tglx, len.brown, artem.bityutskiy, patryk.wlazlyn
Thanks for the feedback so far, sending next version of the patchset.
Lots of simplifications and a little bit of rewording this time.
Rafael, I know you suggested to move the commit message from the
1/3 patch to the 3/3, but I feel like the change for SRF really is in
the 1/3. If you in insist, I'll do that in the v6, but I think It
serves it's purpose better like that, to justify getting rid of the old
algorithm.
Changes since v4:
* Rebased on top of Linus' tree, picking up Rafael's acpi idle patches.
* Remove mwait_play_dead() code entirely from the native_play_dead()
and delegate to idle driver right away, instead.
* ACPI: Don't filter FFH based cstates on AMD, rely on the BIOS to
report them just like the AMD prefers (IOPORT based).
* Apply Peter's suggestion to intel idle to define a default enter_dead
handler for all platforms in intel idle and allow for overwriting
that in case It is needed.
Patryk Wlazlyn (3):
x86/smp: Allow calling mwait_play_dead with an arbitrary hint
ACPI: processor_idle: Add FFH state handling
intel_idle: Provide the default enter_dead() handler
arch/x86/include/asm/smp.h | 3 +++
arch/x86/kernel/acpi/cstate.c | 9 +++++++
arch/x86/kernel/smpboot.c | 46 ++++-------------------------------
drivers/acpi/processor_idle.c | 2 ++
drivers/idle/intel_idle.c | 18 ++++++++++++--
include/acpi/processor.h | 5 ++++
6 files changed, 40 insertions(+), 43 deletions(-)
--
2.47.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v5 1/3] x86/smp: Allow calling mwait_play_dead with an arbitrary hint
2024-11-26 20:15 [PATCH v5 0/3] SRF: Fix offline CPU preventing pc6 entry Patryk Wlazlyn
@ 2024-11-26 20:15 ` Patryk Wlazlyn
2024-11-27 5:54 ` Gautham R. Shenoy
2024-11-26 20:15 ` [PATCH v5 2/3] ACPI: processor_idle: Add FFH state handling Patryk Wlazlyn
2024-11-26 20:15 ` [PATCH v5 3/3] intel_idle: Provide the default enter_dead() handler Patryk Wlazlyn
2 siblings, 1 reply; 7+ messages in thread
From: Patryk Wlazlyn @ 2024-11-26 20:15 UTC (permalink / raw)
To: x86
Cc: linux-kernel, linux-pm, rafael.j.wysocki, peterz, dave.hansen,
gautham.shenoy, tglx, len.brown, artem.bityutskiy, patryk.wlazlyn
The MWAIT instruction needs different hints on different CPUs to reach
specific idle states. The current hint calculation* in mwait_play_dead()
code works in practice on current Intel hardware, but it fails on a
recent one, Intel's Sierra Forest and possibly some future ones. Those
newer CPUs' power efficiency suffers when the CPU is put offline.
* The current algorithm for looking up the mwait hint for the deepest
cstate, in mwait_play_dead() code works by inspecting CPUID leaf 0x5 and
calculates the mwait hint based on the number of reported substates.
This approach depends on the hints associated with them to be continuous
in the range [0, NUM_SUBSTATES-1]. This continuity is not documented and
is not met on the recent Intel platforms.
For example, Intel's Sierra Forest report two cstates with two substates
each in cpuid leaf 0x5:
Name* target cstate target subcstate (mwait hint)
===========================================================
C1 0x00 0x00
C1E 0x00 0x01
-- 0x10 ----
C6S 0x20 0x22
C6P 0x20 0x23
-- 0x30 ----
/* No more (sub)states all the way down to the end. */
===========================================================
* Names of the cstates are not included in the CPUID leaf 0x5, they are
taken from the product specific documentation.
Notice that hints 0x20 and 0x21 are skipped entirely for the target
cstate 0x20 (C6), being a cause of the problem for the current cpuid
leaf 0x5 algorithm.
Allow cpuidle code to call mwait play dead loop with a known hint for
the deepest idle state on a given platform, skipping the cpuid based
calculation.
Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
---
arch/x86/include/asm/smp.h | 3 +++
arch/x86/kernel/smpboot.c | 46 +++++---------------------------------
2 files changed, 8 insertions(+), 41 deletions(-)
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index ca073f40698f..633b4a4aec6b 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -114,6 +114,7 @@ void wbinvd_on_cpu(int cpu);
int wbinvd_on_all_cpus(void);
void smp_kick_mwait_play_dead(void);
+void mwait_play_dead(unsigned long hint);
void native_smp_send_reschedule(int cpu);
void native_send_call_func_ipi(const struct cpumask *mask);
@@ -164,6 +165,8 @@ static inline struct cpumask *cpu_llc_shared_mask(int cpu)
{
return (struct cpumask *)cpumask_of(0);
}
+
+static inline void mwait_play_dead(unsigned long eax_hint) { }
#endif /* CONFIG_SMP */
#ifdef CONFIG_DEBUG_NMI_SELFTEST
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index b5a8f0891135..5dc143e1d6af 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1276,45 +1276,9 @@ void play_dead_common(void)
* We need to flush the caches before going to sleep, lest we have
* dirty data in our caches when we come back up.
*/
-static inline void mwait_play_dead(void)
+void __noreturn mwait_play_dead(unsigned long eax_hint)
{
struct mwait_cpu_dead *md = this_cpu_ptr(&mwait_cpu_dead);
- unsigned int eax, ebx, ecx, edx;
- unsigned int highest_cstate = 0;
- unsigned int highest_subcstate = 0;
- int i;
-
- if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
- boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
- return;
- if (!this_cpu_has(X86_FEATURE_MWAIT))
- return;
- if (!this_cpu_has(X86_FEATURE_CLFLUSH))
- return;
- if (__this_cpu_read(cpu_info.cpuid_level) < CPUID_MWAIT_LEAF)
- return;
-
- eax = CPUID_MWAIT_LEAF;
- ecx = 0;
- native_cpuid(&eax, &ebx, &ecx, &edx);
-
- /*
- * eax will be 0 if EDX enumeration is not valid.
- * Initialized below to cstate, sub_cstate value when EDX is valid.
- */
- if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED)) {
- eax = 0;
- } else {
- edx >>= MWAIT_SUBSTATE_SIZE;
- for (i = 0; i < 7 && edx; i++, edx >>= MWAIT_SUBSTATE_SIZE) {
- if (edx & MWAIT_SUBSTATE_MASK) {
- highest_cstate = i;
- highest_subcstate = edx & MWAIT_SUBSTATE_MASK;
- }
- }
- eax = (highest_cstate << MWAIT_SUBSTATE_SIZE) |
- (highest_subcstate - 1);
- }
/* Set up state for the kexec() hack below */
md->status = CPUDEAD_MWAIT_WAIT;
@@ -1335,7 +1299,7 @@ static inline void mwait_play_dead(void)
mb();
__monitor(md, 0, 0);
mb();
- __mwait(eax, 0);
+ __mwait(eax_hint, 0);
if (READ_ONCE(md->control) == CPUDEAD_MWAIT_KEXEC_HLT) {
/*
@@ -1407,9 +1371,9 @@ void native_play_dead(void)
play_dead_common();
tboot_shutdown(TB_SHUTDOWN_WFS);
- mwait_play_dead();
- if (cpuidle_play_dead())
- hlt_play_dead();
+ /* Below returns only on error. */
+ cpuidle_play_dead();
+ hlt_play_dead();
}
#else /* ... !CONFIG_HOTPLUG_CPU */
--
2.47.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v5 2/3] ACPI: processor_idle: Add FFH state handling
2024-11-26 20:15 [PATCH v5 0/3] SRF: Fix offline CPU preventing pc6 entry Patryk Wlazlyn
2024-11-26 20:15 ` [PATCH v5 1/3] x86/smp: Allow calling mwait_play_dead with an arbitrary hint Patryk Wlazlyn
@ 2024-11-26 20:15 ` Patryk Wlazlyn
2024-11-26 20:15 ` [PATCH v5 3/3] intel_idle: Provide the default enter_dead() handler Patryk Wlazlyn
2 siblings, 0 replies; 7+ messages in thread
From: Patryk Wlazlyn @ 2024-11-26 20:15 UTC (permalink / raw)
To: x86
Cc: linux-kernel, linux-pm, rafael.j.wysocki, peterz, dave.hansen,
gautham.shenoy, tglx, len.brown, artem.bityutskiy, patryk.wlazlyn
One of the preceding commits removed the CPUID leaf 0x5 based play_dead
in favor of delegating the play_dead functionality to the idle driver.
It was mainly (perhaps exclusively) used for Intel CPUs. Add handling of
the FFH states to the acpi idle driver in case intel idle is missing.
Notice, that on Intel, play_dead code relies on intel idle driver to be
present or BIOS to expose the desired states now. On AMD, since the
preferred play_dead method is via HLT or IOPORT over FFH/MWAIT, the code
relies on BIOS to expose the states that will allow for efficient
play_dead.
Suggested-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
---
arch/x86/kernel/acpi/cstate.c | 9 +++++++++
drivers/acpi/processor_idle.c | 2 ++
include/acpi/processor.h | 5 +++++
3 files changed, 16 insertions(+)
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index f3ffd0a3a012..ee2933001acf 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -204,6 +204,15 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
}
EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_probe);
+void acpi_processor_ffh_play_dead(struct acpi_processor_cx *cx)
+{
+ unsigned int cpu = smp_processor_id();
+ struct cstate_entry *percpu_entry;
+
+ percpu_entry = per_cpu_ptr(cpu_cstate_entry, cpu);
+ mwait_play_dead(percpu_entry->states[cx->index].eax);
+}
+
void __cpuidle acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cx)
{
unsigned int cpu = smp_processor_id();
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index ce728cf7e301..83213fa47c1b 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -590,6 +590,8 @@ static void acpi_idle_play_dead(struct cpuidle_device *dev, int index)
raw_safe_halt();
else if (cx->entry_method == ACPI_CSTATE_SYSTEMIO) {
io_idle(cx->address);
+ } else if (cx->entry_method == ACPI_CSTATE_FFH) {
+ acpi_processor_ffh_play_dead(cx);
} else
return;
}
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index a17e97e634a6..63a37e72b721 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -280,6 +280,7 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
struct acpi_processor_cx *cx,
struct acpi_power_register *reg);
void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cstate);
+void acpi_processor_ffh_play_dead(struct acpi_processor_cx *cx);
#else
static inline void acpi_processor_power_init_bm_check(struct
acpi_processor_flags
@@ -300,6 +301,10 @@ static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx
{
return;
}
+static inline void acpi_processor_ffh_play_dead(struct acpi_processor_cx *cx)
+{
+ return;
+}
#endif
static inline int call_on_cpu(int cpu, long (*fn)(void *), void *arg,
--
2.47.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v5 3/3] intel_idle: Provide the default enter_dead() handler
2024-11-26 20:15 [PATCH v5 0/3] SRF: Fix offline CPU preventing pc6 entry Patryk Wlazlyn
2024-11-26 20:15 ` [PATCH v5 1/3] x86/smp: Allow calling mwait_play_dead with an arbitrary hint Patryk Wlazlyn
2024-11-26 20:15 ` [PATCH v5 2/3] ACPI: processor_idle: Add FFH state handling Patryk Wlazlyn
@ 2024-11-26 20:15 ` Patryk Wlazlyn
2 siblings, 0 replies; 7+ messages in thread
From: Patryk Wlazlyn @ 2024-11-26 20:15 UTC (permalink / raw)
To: x86
Cc: linux-kernel, linux-pm, rafael.j.wysocki, peterz, dave.hansen,
gautham.shenoy, tglx, len.brown, artem.bityutskiy, patryk.wlazlyn
The recent mwait_play_dead code relies on cpuidle driver to call the
function with the right mwait hint, for the deepest cstate for which the
driver provides the enter_dead handler.
Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
---
drivers/idle/intel_idle.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index ac4d8faa3886..c6874a6dbe95 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(eax);
+}
+
/*
* States are indexed by the cstate number,
* which is also the index into the MWAIT hint array.
@@ -1798,6 +1809,7 @@ static void __init intel_idle_init_cstates_acpi(struct cpuidle_driver *drv)
state->flags |= CPUIDLE_FLAG_TIMER_STOP;
state->enter = intel_idle;
+ state->enter_dead = intel_idle_enter_dead;
state->enter_s2idle = intel_idle_s2idle;
}
}
@@ -2143,10 +2155,12 @@ static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv)
if (intel_idle_max_cstate_reached(cstate))
break;
- if (!cpuidle_state_table[cstate].enter &&
- !cpuidle_state_table[cstate].enter_s2idle)
+ if (!cpuidle_state_table[cstate].enter)
break;
+ if (!cpuidle_state_table[cstate].enter_dead)
+ cpuidle_state_table[cstate].enter_dead = intel_idle_enter_dead;
+
/* If marked as unusable, skip this state. */
if (cpuidle_state_table[cstate].flags & CPUIDLE_FLAG_UNUSABLE) {
pr_debug("state %s is disabled\n",
--
2.47.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v5 1/3] x86/smp: Allow calling mwait_play_dead with an arbitrary hint
2024-11-26 20:15 ` [PATCH v5 1/3] x86/smp: Allow calling mwait_play_dead with an arbitrary hint Patryk Wlazlyn
@ 2024-11-27 5:54 ` Gautham R. Shenoy
2024-11-27 8:32 ` Patryk Wlazlyn
0 siblings, 1 reply; 7+ messages in thread
From: Gautham R. Shenoy @ 2024-11-27 5:54 UTC (permalink / raw)
To: Patryk Wlazlyn
Cc: x86, linux-kernel, linux-pm, rafael.j.wysocki, peterz,
dave.hansen, tglx, len.brown, artem.bityutskiy
Hello Patryk,
On Tue, Nov 26, 2024 at 09:15:37PM +0100, Patryk Wlazlyn wrote:
> The MWAIT instruction needs different hints on different CPUs to reach
> specific idle states. The current hint calculation* in mwait_play_dead()
> code works in practice on current Intel hardware, but it fails on a
> recent one, Intel's Sierra Forest and possibly some future ones. Those
> newer CPUs' power efficiency suffers when the CPU is put offline.
>
> * The current algorithm for looking up the mwait hint for the deepest
> cstate, in mwait_play_dead() code works by inspecting CPUID leaf 0x5 and
> calculates the mwait hint based on the number of reported substates.
> This approach depends on the hints associated with them to be continuous
> in the range [0, NUM_SUBSTATES-1]. This continuity is not documented and
> is not met on the recent Intel platforms.
>
> For example, Intel's Sierra Forest report two cstates with two substates
> each in cpuid leaf 0x5:
>
> Name* target cstate target subcstate (mwait hint)
> ===========================================================
> C1 0x00 0x00
> C1E 0x00 0x01
>
> -- 0x10 ----
>
> C6S 0x20 0x22
> C6P 0x20 0x23
>
> -- 0x30 ----
>
> /* No more (sub)states all the way down to the end. */
> ===========================================================
>
> * Names of the cstates are not included in the CPUID leaf 0x5, they are
> taken from the product specific documentation.
>
> Notice that hints 0x20 and 0x21 are skipped entirely for the target
> cstate 0x20 (C6), being a cause of the problem for the current cpuid
> leaf 0x5 algorithm.
>
> Allow cpuidle code to call mwait play dead loop with a known hint for
> the deepest idle state on a given platform, skipping the cpuid based
> calculation.
Apologies for what may appear as bikeshedding, after this patch, the
cpuidle code still won't call any mwait based play dead loop since the
support for enter_dead for FFh based idle states in acpi_idle and
intel_idle only gets added in Patches 2 and 3.
Does it make sense to split this Patch 1 into 2 patches : 1/4 and 4/4
1/4 just introduces the mwait_play_dead_with_hint() helper which will
be used by patches 2 and 3.
4/4 get rids of the of logic to find the deepest state from
mwait_play_dead() and modifies native_play_dead() to call
cpuidle_play_dead() followed by hlt_play_dead() thus removing any
reference to mwait_play_dead(). Optionally you can even rename
mwait_play_dead_with_hints() to mwait_play_dead().
That way the changelog that you have for this patch can be used in 4/4
since with the addition of play_dead support for FFh states in both
acpi_idle and intel_idle via patches 2 and 3, the logic to find the
deepest ffh state in mwait_play_dead() is no longer required.
Thoughts ?
--
Thanks and Regards
gautham.
>
> Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
> ---
> arch/x86/include/asm/smp.h | 3 +++
> arch/x86/kernel/smpboot.c | 46 +++++---------------------------------
> 2 files changed, 8 insertions(+), 41 deletions(-)
>
> diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
> index ca073f40698f..633b4a4aec6b 100644
> --- a/arch/x86/include/asm/smp.h
> +++ b/arch/x86/include/asm/smp.h
> @@ -114,6 +114,7 @@ void wbinvd_on_cpu(int cpu);
> int wbinvd_on_all_cpus(void);
>
> void smp_kick_mwait_play_dead(void);
> +void mwait_play_dead(unsigned long hint);
>
> void native_smp_send_reschedule(int cpu);
> void native_send_call_func_ipi(const struct cpumask *mask);
> @@ -164,6 +165,8 @@ static inline struct cpumask *cpu_llc_shared_mask(int cpu)
> {
> return (struct cpumask *)cpumask_of(0);
> }
> +
> +static inline void mwait_play_dead(unsigned long eax_hint) { }
> #endif /* CONFIG_SMP */
>
> #ifdef CONFIG_DEBUG_NMI_SELFTEST
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index b5a8f0891135..5dc143e1d6af 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -1276,45 +1276,9 @@ void play_dead_common(void)
> * We need to flush the caches before going to sleep, lest we have
> * dirty data in our caches when we come back up.
> */
> -static inline void mwait_play_dead(void)
> +void __noreturn mwait_play_dead(unsigned long eax_hint)
> {
> struct mwait_cpu_dead *md = this_cpu_ptr(&mwait_cpu_dead);
> - unsigned int eax, ebx, ecx, edx;
> - unsigned int highest_cstate = 0;
> - unsigned int highest_subcstate = 0;
> - int i;
> -
> - if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
> - boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
> - return;
> - if (!this_cpu_has(X86_FEATURE_MWAIT))
> - return;
> - if (!this_cpu_has(X86_FEATURE_CLFLUSH))
> - return;
> - if (__this_cpu_read(cpu_info.cpuid_level) < CPUID_MWAIT_LEAF)
> - return;
> -
> - eax = CPUID_MWAIT_LEAF;
> - ecx = 0;
> - native_cpuid(&eax, &ebx, &ecx, &edx);
> -
> - /*
> - * eax will be 0 if EDX enumeration is not valid.
> - * Initialized below to cstate, sub_cstate value when EDX is valid.
> - */
> - if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED)) {
> - eax = 0;
> - } else {
> - edx >>= MWAIT_SUBSTATE_SIZE;
> - for (i = 0; i < 7 && edx; i++, edx >>= MWAIT_SUBSTATE_SIZE) {
> - if (edx & MWAIT_SUBSTATE_MASK) {
> - highest_cstate = i;
> - highest_subcstate = edx & MWAIT_SUBSTATE_MASK;
> - }
> - }
> - eax = (highest_cstate << MWAIT_SUBSTATE_SIZE) |
> - (highest_subcstate - 1);
> - }
>
> /* Set up state for the kexec() hack below */
> md->status = CPUDEAD_MWAIT_WAIT;
> @@ -1335,7 +1299,7 @@ static inline void mwait_play_dead(void)
> mb();
> __monitor(md, 0, 0);
> mb();
> - __mwait(eax, 0);
> + __mwait(eax_hint, 0);
>
> if (READ_ONCE(md->control) == CPUDEAD_MWAIT_KEXEC_HLT) {
> /*
> @@ -1407,9 +1371,9 @@ void native_play_dead(void)
> play_dead_common();
> tboot_shutdown(TB_SHUTDOWN_WFS);
>
> - mwait_play_dead();
> - if (cpuidle_play_dead())
> - hlt_play_dead();
> + /* Below returns only on error. */
> + cpuidle_play_dead();
> + hlt_play_dead();
> }
>
> #else /* ... !CONFIG_HOTPLUG_CPU */
> --
> 2.47.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v5 1/3] x86/smp: Allow calling mwait_play_dead with an arbitrary hint
2024-11-27 5:54 ` Gautham R. Shenoy
@ 2024-11-27 8:32 ` Patryk Wlazlyn
2024-11-27 10:53 ` Rafael J. Wysocki
0 siblings, 1 reply; 7+ messages in thread
From: Patryk Wlazlyn @ 2024-11-27 8:32 UTC (permalink / raw)
To: Gautham R. Shenoy
Cc: x86, linux-kernel, linux-pm, rafael.j.wysocki, peterz,
dave.hansen, tglx, len.brown, artem.bityutskiy
> Hello Patryk,
>
> Apologies for what may appear as bikeshedding, after this patch, the
> cpuidle code still won't call any mwait based play dead loop since the
> support for enter_dead for FFh based idle states in acpi_idle and
> intel_idle only gets added in Patches 2 and 3.
>
> Does it make sense to split this Patch 1 into 2 patches : 1/4 and 4/4
>
> 1/4 just introduces the mwait_play_dead_with_hint() helper which will
> be used by patches 2 and 3.
>
> 4/4 get rids of the of logic to find the deepest state from
> mwait_play_dead() and modifies native_play_dead() to call
> cpuidle_play_dead() followed by hlt_play_dead() thus removing any
> reference to mwait_play_dead(). Optionally you can even rename
> mwait_play_dead_with_hints() to mwait_play_dead().
>
> That way the changelog that you have for this patch can be used in 4/4
> since with the addition of play_dead support for FFh states in both
> acpi_idle and intel_idle via patches 2 and 3, the logic to find the
> deepest ffh state in mwait_play_dead() is no longer required.
>
> Thoughts ?
Yeah, makes sense. I just wanted to simplify, but at some point crossed my mind
that submitting it like you suggested may be better. I am going to split that
if I don't see any objections.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v5 1/3] x86/smp: Allow calling mwait_play_dead with an arbitrary hint
2024-11-27 8:32 ` Patryk Wlazlyn
@ 2024-11-27 10:53 ` Rafael J. Wysocki
0 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2024-11-27 10:53 UTC (permalink / raw)
To: Patryk Wlazlyn
Cc: Gautham R. Shenoy, x86, linux-kernel, linux-pm, rafael.j.wysocki,
peterz, dave.hansen, tglx, len.brown, artem.bityutskiy
On Wed, Nov 27, 2024 at 9:33 AM Patryk Wlazlyn
<patryk.wlazlyn@linux.intel.com> wrote:
>
> > Hello Patryk,
> >
> > Apologies for what may appear as bikeshedding, after this patch, the
> > cpuidle code still won't call any mwait based play dead loop since the
> > support for enter_dead for FFh based idle states in acpi_idle and
> > intel_idle only gets added in Patches 2 and 3.
> >
> > Does it make sense to split this Patch 1 into 2 patches : 1/4 and 4/4
> >
> > 1/4 just introduces the mwait_play_dead_with_hint() helper which will
> > be used by patches 2 and 3.
> >
> > 4/4 get rids of the of logic to find the deepest state from
> > mwait_play_dead() and modifies native_play_dead() to call
> > cpuidle_play_dead() followed by hlt_play_dead() thus removing any
> > reference to mwait_play_dead(). Optionally you can even rename
> > mwait_play_dead_with_hints() to mwait_play_dead().
> >
> > That way the changelog that you have for this patch can be used in 4/4
> > since with the addition of play_dead support for FFh states in both
> > acpi_idle and intel_idle via patches 2 and 3, the logic to find the
> > deepest ffh state in mwait_play_dead() is no longer required.
> >
> > Thoughts ?
>
> Yeah, makes sense. I just wanted to simplify, but at some point crossed my mind
> that submitting it like you suggested may be better.
Not just it may be better, but this is the only way to do it or people
who apply the first patch without the other two patches will likely
have problems (and that may easily happen during bisection, for
example).
Things should always work between consecutive patches in a patch series.
> I am going to split that if I don't see any objections.
Yes, please!
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-11-27 10:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-26 20:15 [PATCH v5 0/3] SRF: Fix offline CPU preventing pc6 entry Patryk Wlazlyn
2024-11-26 20:15 ` [PATCH v5 1/3] x86/smp: Allow calling mwait_play_dead with an arbitrary hint Patryk Wlazlyn
2024-11-27 5:54 ` Gautham R. Shenoy
2024-11-27 8:32 ` Patryk Wlazlyn
2024-11-27 10:53 ` Rafael J. Wysocki
2024-11-26 20:15 ` [PATCH v5 2/3] ACPI: processor_idle: Add FFH state handling Patryk Wlazlyn
2024-11-26 20:15 ` [PATCH v5 3/3] intel_idle: Provide the default enter_dead() handler Patryk Wlazlyn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox