* [PATCH v1] cpufreq: intel_pstate: Use HWP to initialize ITMT if CPPC is missing
@ 2024-06-20 16:14 Rafael J. Wysocki
2024-06-20 17:57 ` Mario Limonciello
0 siblings, 1 reply; 2+ messages in thread
From: Rafael J. Wysocki @ 2024-06-20 16:14 UTC (permalink / raw)
To: Linux PM
Cc: Aaron Rainbolt, LKML, Linux ACPI, Srinivas Pandruvada,
Mario Limonciello
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
It is reported that single-thread performance on some hybrid systems
dropped significantly after commit 7feec7430edd ("ACPI: CPPC: Only probe
for _CPC if CPPC v2 is acked") which prevented _CPC from being used if
the support for it had not been confirmed by the platform firmware.
The problem is that if the platform firmware does not confirm CPPC v2
support, cppc_get_perf_caps() returns an error which prevents the
intel_pstate driver from enabling ITMT. Consequently, the scheduler
does not get any hints on CPU performance differences, so in a hybrid
system some tasks may run on CPUs with lower capacity even though they
should be running on high-capacity CPUs.
To address this, modify intel_pstate to use the information from
MSR_HWP_CAPABILITIES to enable ITMT if CPPC is not available (which is
done already if the highest performance number coming from CPPC is not
realistic).
Fixes: 7feec7430edd ("ACPI: CPPC: Only probe for _CPC if CPPC v2 is acked")
Closes: https://lore.kernel.org/linux-acpi/d01b0a1f-bd33-47fe-ab41-43843d8a374f@kfocus.org
Link: https://lore.kernel.org/linux-acpi/ZnD22b3Br1ng7alf@kf-XE
Reported-by: Aaron Rainbolt <arainbolt@kfocus.org>
Tested-by: Aaron Rainbolt <arainbolt@kfocus.org>
Cc: 5.19+ <stable@vger.kernel.org> # 5.19+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/cpufreq/intel_pstate.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -355,15 +355,14 @@ static void intel_pstate_set_itmt_prio(i
int ret;
ret = cppc_get_perf_caps(cpu, &cppc_perf);
- if (ret)
- return;
-
/*
- * On some systems with overclocking enabled, CPPC.highest_perf is hardcoded to 0xff.
- * In this case we can't use CPPC.highest_perf to enable ITMT.
- * In this case we can look at MSR_HWP_CAPABILITIES bits [8:0] to decide.
+ * If CPPC is not available, fall back to MSR_HWP_CAPABILITIES bits [8:0].
+ *
+ * Also, on some systems with overclocking enabled, CPPC.highest_perf is
+ * hardcoded to 0xff, so CPPC.highest_perf cannot be used to enable ITMT.
+ * Fall back to MSR_HWP_CAPABILITIES then too.
*/
- if (cppc_perf.highest_perf == CPPC_MAX_PERF)
+ if (ret || cppc_perf.highest_perf == CPPC_MAX_PERF)
cppc_perf.highest_perf = HWP_HIGHEST_PERF(READ_ONCE(all_cpu_data[cpu]->hwp_cap_cached));
/*
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v1] cpufreq: intel_pstate: Use HWP to initialize ITMT if CPPC is missing
2024-06-20 16:14 [PATCH v1] cpufreq: intel_pstate: Use HWP to initialize ITMT if CPPC is missing Rafael J. Wysocki
@ 2024-06-20 17:57 ` Mario Limonciello
0 siblings, 0 replies; 2+ messages in thread
From: Mario Limonciello @ 2024-06-20 17:57 UTC (permalink / raw)
To: Rafael J. Wysocki, Linux PM
Cc: Aaron Rainbolt, LKML, Linux ACPI, Srinivas Pandruvada
On 6/20/2024 11:14, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> It is reported that single-thread performance on some hybrid systems
> dropped significantly after commit 7feec7430edd ("ACPI: CPPC: Only probe
> for _CPC if CPPC v2 is acked") which prevented _CPC from being used if
> the support for it had not been confirmed by the platform firmware.
>
> The problem is that if the platform firmware does not confirm CPPC v2
> support, cppc_get_perf_caps() returns an error which prevents the
> intel_pstate driver from enabling ITMT. Consequently, the scheduler
> does not get any hints on CPU performance differences, so in a hybrid
> system some tasks may run on CPUs with lower capacity even though they
> should be running on high-capacity CPUs.
>
> To address this, modify intel_pstate to use the information from
> MSR_HWP_CAPABILITIES to enable ITMT if CPPC is not available (which is
> done already if the highest performance number coming from CPPC is not
> realistic).
>
> Fixes: 7feec7430edd ("ACPI: CPPC: Only probe for _CPC if CPPC v2 is acked")
> Closes: https://lore.kernel.org/linux-acpi/d01b0a1f-bd33-47fe-ab41-43843d8a374f@kfocus.org
> Link: https://lore.kernel.org/linux-acpi/ZnD22b3Br1ng7alf@kf-XE
> Reported-by: Aaron Rainbolt <arainbolt@kfocus.org>
> Tested-by: Aaron Rainbolt <arainbolt@kfocus.org>
> Cc: 5.19+ <stable@vger.kernel.org> # 5.19+ > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
> drivers/cpufreq/intel_pstate.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> Index: linux-pm/drivers/cpufreq/intel_pstate.c
> ===================================================================
> --- linux-pm.orig/drivers/cpufreq/intel_pstate.c
> +++ linux-pm/drivers/cpufreq/intel_pstate.c
> @@ -355,15 +355,14 @@ static void intel_pstate_set_itmt_prio(i
> int ret;
>
> ret = cppc_get_perf_caps(cpu, &cppc_perf);
> - if (ret)
> - return;
> -
> /*
> - * On some systems with overclocking enabled, CPPC.highest_perf is hardcoded to 0xff.
> - * In this case we can't use CPPC.highest_perf to enable ITMT.
> - * In this case we can look at MSR_HWP_CAPABILITIES bits [8:0] to decide.
> + * If CPPC is not available, fall back to MSR_HWP_CAPABILITIES bits [8:0].
> + *
> + * Also, on some systems with overclocking enabled, CPPC.highest_perf is
> + * hardcoded to 0xff, so CPPC.highest_perf cannot be used to enable ITMT.
> + * Fall back to MSR_HWP_CAPABILITIES then too.
> */
> - if (cppc_perf.highest_perf == CPPC_MAX_PERF)
> + if (ret || cppc_perf.highest_perf == CPPC_MAX_PERF)
> cppc_perf.highest_perf = HWP_HIGHEST_PERF(READ_ONCE(all_cpu_data[cpu]->hwp_cap_cached));
>
> /*
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-20 17:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-20 16:14 [PATCH v1] cpufreq: intel_pstate: Use HWP to initialize ITMT if CPPC is missing Rafael J. Wysocki
2024-06-20 17:57 ` Mario Limonciello
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox