cpufreq: intel_pstate: Fix Raptor Lake-E cpufreq limits
Subsystems (3)
Srinivas Pandruvada
maintainerPATCH 1/1 cpufreq: intel_pstate: Fix Raptor Lake-E cpufreq limits
Raptor Lake-E processors are not correctly showing cpufreq frequency limits.
These CPUs don't set X86_FEATURE_HYBRID_CPU and have no E-cores, but P-cores still use hybrid scaling factor.
commit 0fcfc9e51990 ("cpufreq: intel_pstate: Fix scaling for hybrid-capable systems with disabled E-cores") added support for such configuration. Here using CPPC nominal freq and perf was compared to still return hybrid scaling factor.
Commit 9b18d536b124 ("cpufreq: intel_pstate: Use CPPC to get scaling factors") restructured hwp_get_cpu_scaling() and added an explicit check for X86_FEATURE_HYBRID_CPU and when not set returns core scaling factor.
To address this remove check for X86_FEATURE_HYBRID_CPU and call intel_pstate_cppc_get_scaling().
Ideally this change should be enough. But using CPPC for scaling factor results in rounding error, so still doesn't restore the original behavior.
In intel_pstate_cppc_get_scaling() return core scaling factor when ACPI CPPC is not present or when CPPC nominal frequency or nominal performance are invalid.
Use hybrid_scaling_factor for P-cores when defined for a CPU, if not calculate from ACPI CPPC nominal frequency and performance.
--- drivers/cpufreq/intel_pstate.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-)
drivers/cpufreq/intel_pstate.c +15 -14
@@ -421,15 +421,23 @@ static int intel_pstate_cppc_get_scaling(int cpu) {struct cppc_perf_caps cppc_perf; +if (cppc_get_perf_caps (cpu, &cppc_perf) || !cppc_perf.nominal_freq || + !cppc_perf.nominal_perf) + goto core_scaling; + +if (cppc_perf.nominal_perf *100 == cppc_perf.nominal_freq) + goto core_scaling; + +if (hybrid_scaling_factor) +return hybrid_scaling_factor; +/* -* Compute the perf-to-frequency scaling factor for the given CPU if -* possible, unless it would be 0. +* Compute the perf-to-frequency scaling factor for the given CPU +* from nominal freq and nominal_perf */ -if (!cppc_get_perf_caps (cpu, &cppc_perf) && - cppc_perf.nominal_perf && cppc_perf.nominal_freq) -return div_u64 (cppc_perf.nominal_freq *KHZ_PER_MHZ , - cppc_perf.nominal_perf); +return div_u64 (cppc_perf.nominal_freq *KHZ_PER_MHZ , cppc_perf.nominal_perf); +core_scaling:return core_get_scaling (); }
@@ -2281,17 +2289,10 @@ static int hwp_get_cpu_scaling(int cpu)*/ if (hybrid_get_cpu_type (cpu) ==INTEL_CPU_TYPE_CORE )return hybrid_scaling_factor; - -return core_get_scaling (); } -/* Use core scaling on non-hybrid systems. */ -if (!cpu_feature_enabled (X86_FEATURE_HYBRID_CPU )) -return core_get_scaling (); -/* -* The system is hybrid, but the hybrid scaling factor is not known or -* the CPU type is not one of the above, so use CPPC to compute the +* The system is hybrid, so use CPPC to compute the * scaling factor for this CPU. */ return intel_pstate_cppc_get_scaling (cpu);
Signature · 1 line
2.43.0
Quoted 6 lines · Srinivas Pandruvada
Raptor Lake-E processors are not correctly showing cpufreq frequency limits.
These CPUs don't set
X86_FEATURE_HYBRID_CPUand have no E-cores, but P-cores still use hybrid scaling factor.
...
Tested on Intel Core 9 273PE (Bartlett Lake P-core only):cpuinfo_max_freq is now correctly reported as 5.5/5.7 GHz, matching the datasheet, via the dynamic CPPC compute path.
On another Bartlett Lake P-core only SKU (Intel Core 7 253PE), the CPPC-computed factor (80645) overshoots the datasheet Max Turbo Frequency (5.5 GHz) by 100 MHz, matching the CPPC rounding error described in the commit message.
I'll send a standalone patch adding Bartlett Lake to intel_hybrid_scaling_factor[] with HYBRID_SCALING_FACTOR_ADL to address the 253PE residual.
Thanks,
Henry
Rafael J. Wysocki
maintainerQuoted 74 lines · Srinivas Pandruvada
Raptor Lake-E processors are not correctly showing cpufreq frequency limits.
These CPUs don't set
X86_FEATURE_HYBRID_CPUand have no E-cores, but P-cores still use hybrid scaling factor.commit
0fcfc9e51990("cpufreq:intel_pstate: Fix scaling for hybrid-capable systems with disabled E-cores") added support for such configuration. Here using CPPC nominal freq and perf was compared to still return hybrid scaling factor.Commit
9b18d536b124("cpufreq:intel_pstate: Use CPPC to get scaling factors") restructuredhwp_get_cpu_scaling()and added an explicit check forX86_FEATURE_HYBRID_CPUand when not set returns core scaling factor.To address this remove check for
X86_FEATURE_HYBRID_CPUand callintel_pstate_cppc_get_scaling().Ideally this change should be enough. But using CPPC for scaling factor results in rounding error, so still doesn't restore the original behavior.
In
intel_pstate_cppc_get_scaling()return core scaling factor when ACPI CPPC is not present or when CPPC nominal frequency or nominal performance are invalid.Use
hybrid_scaling_factorfor P-cores when defined for a CPU, if not calculate from ACPI CPPC nominal frequency and performance.Fixes 9b18d536b124 ("cpufreq: intel_pstate: Use CPPC to get scaling factors")Reported-by Henry Tseng <[email protected]>Signed-off-by Srinivas Pandruvada <[email protected]>--- drivers/cpufreq/intel_pstate.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-)drivers/cpufreq/intel_pstate.c +14
-6@@ -421,15 +421,23 @@ static int intel_pstate_cppc_get_scaling(int cpu) {struct cppc_perf_caps cppc_perf; +if (cppc_get_perf_caps (cpu, &cppc_perf) || !cppc_perf.nominal_freq || + !cppc_perf.nominal_perf) + goto core_scaling; + +if (cppc_perf.nominal_perf *100 == cppc_perf.nominal_freq) + goto core_scaling; + +if (hybrid_scaling_factor) +return hybrid_scaling_factor; +/* -* Compute the perf-to-frequency scaling factor for the given CPU if -* possible, unless it would be 0. +* Compute the perf-to-frequency scaling factor for the given CPU +* from nominal freq and nominal_perf */ -if (!cppc_get_perf_caps (cpu, &cppc_perf) && - cppc_perf.nominal_perf && cppc_perf.nominal_freq) -return div_u64 (cppc_perf.nominal_freq *KHZ_PER_MHZ , - cppc_perf.nominal_perf); +return div_u64 (cppc_perf.nominal_freq *KHZ_PER_MHZ , cppc_perf.nominal_perf); +core_scaling:return core_get_scaling (); }
drivers/cpufreq/intel_pstate.c static int hwp_get_cpu_scaling(int cpu) · line 2285
Quoted 5 lines
drivers/cpufreq/intel_pstate.c +0
-2@@ -2281,17 +2289,10 @@ static int hwp_get_cpu_scaling(int cpu)*/ if (hybrid_get_cpu_type (cpu) ==INTEL_CPU_TYPE_CORE )return hybrid_scaling_factor; - -return core_get_scaling ();
Why is this change necessary or even useful?
This is about E-cores (because P-cores have been covered above) and if hybrid_scaling_factor is set, it is known that the processor is hybrid and E-cores have the "core" scaling factor.
Or is Raptor Lake-E covered by one of the intel_hybrid_scaling_factor[] entries and hybrid_get_cpu_type(cpu) doesn't return INTEL_CPU_TYPE_CORE on it? This piece of information is missing from the changelog.
drivers/cpufreq/intel_pstate.c static int hwp_get_cpu_scaling(int cpu) · line 2291
Quoted 6 lines
drivers/cpufreq/intel_pstate.c +0
-4} -/* Use core scaling on non-hybrid systems. */ -if (!cpu_feature_enabled (X86_FEATURE_HYBRID_CPU )) -return core_get_scaling (); -
So we're now exposing all of the non-hybrid processors to the fun with possibly incorrectly populated CPPC, which is kind of risky.
If Raptor Lake-E is not covered by an existing intel_hybrid_scaling_factor[] entry, why don't we add one for it with a "scaling factor" value indicating that CPPC needs to be used for computing it on all CPUs?
Quoted 8 lines
drivers/cpufreq/intel_pstate.c +1
-3/* -* The system is hybrid, but the hybrid scaling factor is not known or -* the CPU type is not one of the above, so use CPPC to compute the +* The system is hybrid, so use CPPC to compute the * scaling factor for this CPU. */ return intel_pstate_cppc_get_scaling (cpu); --
srinivas pandruvada
maintainerQuoted 109 lines · Rafael J. Wysocki
Quoted 93 lines · Srinivas Pandruvada
Raptor Lake-E processors are not correctly showing cpufreq frequency
limits.These CPUs don't set
X86_FEATURE_HYBRID_CPUand have no E-cores, but
P-cores still use hybrid scaling factor.commit
0fcfc9e51990("cpufreq:intel_pstate: Fix scaling for hybrid-capable systems with disabled E-cores") added support for such configuration. Here using CPPC nominal freq and perf was compared
to still return hybrid scaling factor.Commit
9b18d536b124("cpufreq:intel_pstate: Use CPPC to get scaling
factors") restructuredhwp_get_cpu_scaling()and added an explicit check
forX86_FEATURE_HYBRID_CPUand when not set returns core scaling factor.To address this remove check for
X86_FEATURE_HYBRID_CPUand callintel_pstate_cppc_get_scaling().Ideally this change should be enough. But using CPPC for scaling factor
results in rounding error, so still doesn't restore the original behavior.In
intel_pstate_cppc_get_scaling()return core scaling factor when ACPI CPPC is not present or when CPPC nominal frequency or nominal performance are invalid.Use
hybrid_scaling_factorfor P-cores when defined for a CPU, if not
calculate from ACPI CPPC nominal frequency and performance.Fixes 9b18d536b124 ("cpufreq: intel_pstate: Use CPPC to getscaling factors")
Reported-by Henry Tseng <[email protected]>Closes:
https://lore.kernel.org/linux-pm/[email protected]/
Signed-off-by: Srinivas Pandruvada <[email protected]>
Cc: [email protected]
---
drivers/cpufreq/intel_pstate.c | 29 +++++++++++++++--------------1 file changed, 15 insertions(+), 14 deletions(-)drivers/cpufreq/intel_pstate.c +1
-0@@ -421,15 +421,23 @@ static int intel_pstate_cppc_get_scaling(int cpu) { struct cppc_perf_caps cppc_perf; + if (cppc_get_perf_caps(cpu, &cppc_perf) ||!cppc_perf.nominal_freq ||
+ !cppc_perf.nominal_perf)
+ gotocore_scaling;drivers/cpufreq/intel_pstate.c +7
-0+ + if (cppc_perf.nominal_perf * 100 == cppc_perf.nominal_freq) + goto core_scaling; + + if (hybrid_scaling_factor) + return hybrid_scaling_factor; +/*
- * Compute the perf-to-frequency scaling factor for the given CPU if
- * possible, unless it would be 0.
+ * Compute the perf-to-frequency scaling factor for the given CPU
+ * from nominal freq andnominal_perf
*/
- if (!cppc_get_perf_caps(cpu,&cppc_perf) &&
- cppc_perf.nominal_perf && cppc_perf.nominal_freq) - return div_u64(cppc_perf.nominal_freq *KHZ_PER_MHZ,
- cppc_perf.nominal_perf); + returndiv_u64(cppc_perf.nominal_freq * KHZ_PER_MHZ, cppc_perf.nominal_perf);+core_scaling:
returncore_get_scaling();
}drivers/cpufreq/intel_pstate.c +0
-0@@ -2281,17 +2289,10 @@ static int hwp_get_cpu_scaling(int cpu)*/ Quoted 5 lines
if (
hybrid_get_cpu_type(cpu)==INTEL_CPU_TYPE_CORE)
returnhybrid_scaling_factor; -
- returncore_get_scaling();Why is this change necessary or even useful?
This is about E-cores (because P-cores have been covered above) and if
hybrid_scaling_factoris set, it is known that the processor is hybrid
and E-cores have the "core" scaling factor.
Quoted 4 lines
Or is Raptor Lake-E covered by one of the intel_hybrid_scaling_factor[] entries and
hybrid_get_cpu_type(cpu)doesn't returnINTEL_CPU_TYPE_COREon it? This piece of information is missing from the changelog.
Raptor Lake-E (Xeon) uses CPU model as Raptor Lake-S, for which there is already a hardcoded scaling factor in the driver. So this "if" block will enter. But since there is no hybrid CPUID feature is defined, hybrid_get_cpu_type(cpu) will return 0 for P-core or E-core. Here there are no E-cores. So need to remove core_get_scaling() as this will return non hybrid factor.
Quoted 12 lines
Quoted 7 lines
}
- /* Use core scaling on non-hybrid systems. */ - if (!cpu_feature_enabled(X86_FEATURE_HYBRID_CPU)) - return
core_get_scaling();
-So we're now exposing all of the non-hybrid processors to the fun with
possibly incorrectly populated CPPC, which is kind of risky.
This was already used before with commit0fcfc9e51990246a9813475716746ff5eb98c6aa
relying that all non hybrid processor (including servers) didn't set nominal frequency, so will return core_scaling without using CPPC. I retested change on servers and non hybrids.
Quoted 4 lines
If Raptor Lake-E is not covered by an existing intel_hybrid_scaling_factor[] entry, why don't we add one for it with a "scaling factor" value indicating that CPPC needs to be used for computing it on all CPUs?
It is already covered by existing, but we can only call for intel_pstate_cppc_get_scaling() when hybrid_scaling_factor is defined. This will require a hardcoding for Bartlett Lake also which uses different CPU model, which Henry Tseng is planing to send.
Thanks,
Srinivas
Quoted 11 lines
Quoted 11 lines
/*
- * The system is hybrid, but the hybrid scaling factor is not known or
- * the CPU type is not one of the above, so use CPPC to compute the
+ * The system is hybrid, so use CPPC to compute the
* scaling factor for this CPU.
*/
returnintel_pstate_cppc_get_scaling(cpu);
--
Rafael J. Wysocki
maintainerQuoted 111 lines · srinivas pandruvada
Quoted 109 lines · Rafael J. Wysocki
Quoted 92 lines · Srinivas Pandruvada
Raptor Lake-E processors are not correctly showing cpufreq frequency
limits.These CPUs don't set
X86_FEATURE_HYBRID_CPUand have no E-cores, but
P-cores still use hybrid scaling factor.commit
0fcfc9e51990("cpufreq:intel_pstate: Fix scaling for hybrid-capable systems with disabled E-cores") added support for such configuration. Here using CPPC nominal freq and perf was compared
to still return hybrid scaling factor.Commit
9b18d536b124("cpufreq:intel_pstate: Use CPPC to get scaling
factors") restructuredhwp_get_cpu_scaling()and added an explicit check
forX86_FEATURE_HYBRID_CPUand when not set returns core scaling factor.To address this remove check for
X86_FEATURE_HYBRID_CPUand callintel_pstate_cppc_get_scaling().Ideally this change should be enough. But using CPPC for scaling factor
results in rounding error, so still doesn't restore the original behavior.In
intel_pstate_cppc_get_scaling()return core scaling factor when ACPI CPPC is not present or when CPPC nominal frequency or nominal performance are invalid.Use
hybrid_scaling_factorfor P-cores when defined for a CPU, if not
calculate from ACPI CPPC nominal frequency and performance.Fixes 9b18d536b124 ("cpufreq: intel_pstate: Use CPPC to getscaling factors")
Reported-by Henry Tseng <[email protected]>Closes:
https://lore.kernel.org/linux-pm/[email protected]/
Signed-off-by: Srinivas Pandruvada
<[email protected]>
Cc: [email protected]--- drivers/cpufreq/intel_pstate.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-)drivers/cpufreq/intel_pstate.c +1
-0@@ -421,15 +421,23 @@ static int intel_pstate_cppc_get_scaling(int cpu) {struct cppc_perf_caps cppc_perf; + if (cppc_get_perf_caps(cpu, &cppc_perf) ||!cppc_perf.nominal_freq ||
drivers/cpufreq/intel_pstate.c +9
-1+ !cppc_perf.nominal_perf) + goto core_scaling; + +if (cppc_perf.nominal_perf *100 == cppc_perf.nominal_freq) + goto core_scaling; + +if (hybrid_scaling_factor) +return hybrid_scaling_factor; +/* -* Compute the perf-to-frequency scaling factor for the given CPU if
drivers/cpufreq/intel_pstate.c +1
-1-* possible, unless it would be 0. +* Compute the perf-to-frequency scaling factor for the given CPU
drivers/cpufreq/intel_pstate.c +1
-3+* from nominal freq and nominal_perf */ -if (!cppc_get_perf_caps (cpu, &cppc_perf) && - cppc_perf.nominal_perf && cppc_perf.nominal_freq) - return div_u64(cppc_perf.nominal_freq *
KHZ_PER_MHZ,drivers/cpufreq/intel_pstate.c +1
-1- cppc_perf.nominal_perf); + return div_u64(cppc_perf.nominal_freq * KHZ_PER_MHZ,cppc_perf.nominal_perf);
drivers/cpufreq/intel_pstate.c +1
-0+core_scaling:return core_get_scaling (); }drivers/cpufreq/intel_pstate.c static int hwp_get_cpu_scaling(int cpu) · line 2286
Quoted 6 lines
drivers/cpufreq/intel_pstate.c +0
-2@@ -2281,17 +2289,10 @@ static int hwp_get_cpu_scaling(int cpu)*/ if (hybrid_get_cpu_type (cpu) ==INTEL_CPU_TYPE_CORE )return hybrid_scaling_factor; - -return core_get_scaling ();Why is this change necessary or even useful?
This is about E-cores (because P-cores have been covered above) and if
hybrid_scaling_factoris set, it is known that the processor is hybrid
and E-cores have the "core" scaling factor.
Quoted 7 lines
Quoted 4 lines
Or is Raptor Lake-E covered by one of the intel_hybrid_scaling_factor[] entries and
hybrid_get_cpu_type(cpu)doesn't returnINTEL_CPU_TYPE_COREon it? This piece of information is missing from the changelog.Raptor Lake-E (Xeon) uses CPU model as Raptor Lake-S, for which there is already a hardcoded scaling factor in the driver.
This piece of information needs to be added to the changelog in the first place because it is key here.
Quoted 4 lines
So this "if" block will enter. But since there is no hybrid CPUID feature is defined,
hybrid_get_cpu_type(cpu)will return 0 for P-core or E-core. Here there are no E-cores. So need to removecore_get_scaling()as this will return non hybrid factor.
Well, what about this:
--- drivers/cpufreq/intel_pstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/intel_pstate.c +1 -1
@@ -2279,7 +2279,7 @@ static int hwp_get_cpu_scaling(int cpu)* Return the hybrid scaling factor for P-cores and use the * default core scaling for E-cores. */ -if (hybrid_get_cpu_type (cpu) ==INTEL_CPU_TYPE_CORE ) +if (hybrid_get_cpu_type (cpu) !=INTEL_CPU_TYPE_ATOM )return hybrid_scaling_factor;return core_get_scaling ();
Or is the original Raptor Lake-S scaling factor unsuitable for Raptor Lake-E?
Quoted 26 lines
Quoted 5 lines
Quoted 5 lines
drivers/cpufreq/intel_pstate.c +0
-0}Quoted 9 lines
drivers/cpufreq/intel_pstate.c static int hwp_get_cpu_scaling(int cpu) · line 2292
Quoted 4 lines
drivers/cpufreq/intel_pstate.c +0
-4-/* Use core scaling on non-hybrid systems. */ -if (!cpu_feature_enabled (X86_FEATURE_HYBRID_CPU )) -return core_get_scaling (); -So we're now exposing all of the non-hybrid processors to the fun with
possibly incorrectly populated CPPC, which is kind of risky.This was already used before with commit0fcfc9e51990246a9813475716746ff5eb98c6aa
relying that all non hybrid processor (including servers) didn't set nominal frequency, so will returncore_scalingwithout using CPPC. I retested change on servers and non hybrids.Quoted 4 lines
If Raptor Lake-E is not covered by an existing intel_hybrid_scaling_factor[] entry, why don't we add one for it with a "scaling factor" value indicating that CPPC needs to be used for computing it on all CPUs?
Quoted 4 lines
It is already covered by existing, but we can only call for
intel_pstate_cppc_get_scaling()whenhybrid_scaling_factoris defined. This will require a hardcoding for Bartlett Lake also which uses different CPU model, which Henry Tseng is planing to send.
I would add a new intel_hybrid_scaling_factor[] entry for Bartlett Lake then with a proper scaling factor along with the change above.
srinivas pandruvada
maintainerQuoted 166 lines · Rafael J. Wysocki
Quoted 132 lines · srinivas pandruvada
Quoted 123 lines · Rafael J. Wysocki
Quoted 106 lines · Srinivas Pandruvada
Raptor Lake-E processors are not correctly showing cpufreq frequency
limits.These CPUs don't set
X86_FEATURE_HYBRID_CPUand have no E- cores,
but
P-cores still use hybrid scaling factor.commit
0fcfc9e51990("cpufreq:intel_pstate: Fix scaling for hybrid-capable systems with disabled E-cores") added support for
such configuration. Here using CPPC nominal freq and perf was compared
to still return hybrid scaling factor.Commit
9b18d536b124("cpufreq:intel_pstate: Use CPPC to get scaling
factors") restructuredhwp_get_cpu_scaling()and added an explicit
check
forX86_FEATURE_HYBRID_CPUand when not set returns core scaling
factor.To address this remove check for
X86_FEATURE_HYBRID_CPUand callintel_pstate_cppc_get_scaling().Ideally this change should be enough. But using CPPC for scaling
factor
results in rounding error, so still doesn't restore the original
behavior.In
intel_pstate_cppc_get_scaling()return core scaling factor when
ACPI CPPC is not present or when CPPC nominal frequency or nominal
performance are invalid.Use
hybrid_scaling_factorfor P-cores when defined for a CPU, if
not
calculate from ACPI CPPC nominal frequency and performance.Fixes 9b18d536b124 ("cpufreq: intel_pstate: Use CPPC to getscaling factors")
Reported-by Henry Tseng <[email protected]>Closes:
https://lore.kernel.org/linux-pm/[email protected]/
Signed-off-by: Srinivas Pandruvada <[email protected]>
Cc: [email protected]
---
drivers/cpufreq/intel_pstate.c | 29 +++++++++++++++-----------
---1 file changed, 15 insertions(+), 14 deletions(-)drivers/cpufreq/intel_pstate.c +0
-0@@ -421,15 +421,23 @@ static intintel_pstate_cppc_get_scaling(int
cpu)
{
structcppc_perf_capscppc_perf;+ if (
cppc_get_perf_caps(cpu, &cppc_perf)|| !cppc_perf.nominal_freq ||
+ !cppc_perf.nominal_perf)
+ gotocore_scaling;
+
+ if (cppc_perf.nominal_perf * 100 == cppc_perf.nominal_freq)
+ gotocore_scaling;drivers/cpufreq/intel_pstate.c +4
-0+ + if (hybrid_scaling_factor) + return hybrid_scaling_factor; +/*
- * Compute the perf-to-frequency scaling factor for the given CPU if
- * possible, unless it would be 0.
+ * Compute the perf-to-frequency scaling factor for the given CPU
+ * from nominal freq andnominal_perf
*/
- if (!cppc_get_perf_caps(cpu,&cppc_perf) &&
- cppc_perf.nominal_perf && cppc_perf.nominal_freq) - return div_u64(cppc_perf.nominal_freq *KHZ_PER_MHZ,
- cppc_perf.nominal_perf); + returndiv_u64(cppc_perf.nominal_freq * KHZ_PER_MHZ, cppc_perf.nominal_perf);+core_scaling:
returncore_get_scaling();
}drivers/cpufreq/intel_pstate.c +0
-0@@ -2281,17 +2289,10 @@ static int hwp_get_cpu_scaling(int cpu)*/ Quoted 5 lines
if (
hybrid_get_cpu_type(cpu)==INTEL_CPU_TYPE_CORE)
returnhybrid_scaling_factor; -
- returncore_get_scaling();Why is this change necessary or even useful?
This is about E-cores (because P-cores have been covered above) and
ifhybrid_scaling_factoris set, it is known that the processor is hybrid
and E-cores have the "core" scaling factor.Quoted 6 lines
Or is Raptor Lake-E covered by one of the intel_hybrid_scaling_factor[] entries and
hybrid_get_cpu_type(cpu)
doesn't returnINTEL_CPU_TYPE_COREon it? This piece of information
is missing from the changelog.Quoted 3 lines
Raptor Lake-E (Xeon) uses CPU model as Raptor Lake-S, for which there
is already a hardcoded scaling factor in the driver.This piece of information needs to be added to the changelog in the first place because it is key here.
Quoted 6 lines
So this "if" block will enter. But since there is no hybrid CPUID feature is defined,
hybrid_get_cpu_type(cpu)will return 0 for P-core or E-core. Here there
are no E-cores. So need to removecore_get_scaling()as this will return non hybrid factor.Well, what about this:
---
drivers/cpufreq/intel_pstate.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/cpufreq/intel_pstate.c +1
-1@@ -2279,7 +2279,7 @@ static int hwp_get_cpu_scaling(int cpu)* Return the hybrid scaling factor for P-cores and use the * default core scaling for E-cores. */ - if (hybrid_get_cpu_type(cpu) == INTEL_CPU_TYPE_CORE) + if (hybrid_get_cpu_type(cpu) != INTEL_CPU_TYPE_ATOM) return hybrid_scaling_factor; return core_get_scaling();
Quoted 2 lines
Or is the original Raptor Lake-S scaling factor unsuitable for Raptor Lake-E?
This will work for RPL-E. But the original change also accounted for core scaling on hybrid. There was some embedded hybrid capable with P core only, used core scaling. Don't find that system details anymore.
But fine, we can live with this change with added Bartlett Lake scaling factor.
Thanks,
Srinivas
Quoted 38 lines
Quoted 30 lines
Quoted 6 lines
Quoted 6 lines
}
Quoted 9 lines
Quoted 4 lines
- /* Use core scaling on non-hybrid systems. */ - if (!cpu_feature_enabled(X86_FEATURE_HYBRID_CPU)) - return
core_get_scaling();
-So we're now exposing all of the non-hybrid processors to the fun with
possibly incorrectly populated CPPC, which is kind of risky.This was already used before with commit0fcfc9e51990246a9813475716746ff5eb98c6aa
relying that all non hybrid processor (including servers) didn't set
nominal frequency, so will returncore_scalingwithout using CPPC. I retested change on servers and non hybrids.Quoted 6 lines
If Raptor Lake-E is not covered by an existing intel_hybrid_scaling_factor[] entry, why don't we add one for it with
a "scaling factor" value indicating that CPPC needs to be used for
computing it on all CPUs?Quoted 5 lines
It is already covered by existing, but we can only call for
intel_pstate_cppc_get_scaling()whenhybrid_scaling_factoris defined. This will require a hardcoding for Bartlett Lake also which
uses different CPU model, which Henry Tseng is planing to send.I would add a new intel_hybrid_scaling_factor[] entry for Bartlett Lake then with a proper scaling factor along with the change above.
Rafael J. Wysocki
maintainerQuoted 166 lines · srinivas pandruvada
Quoted 164 lines · Rafael J. Wysocki
Quoted 132 lines · srinivas pandruvada
Quoted 123 lines · Rafael J. Wysocki
Quoted 105 lines · Srinivas Pandruvada
Raptor Lake-E processors are not correctly showing cpufreq frequency
limits.These CPUs don't set
X86_FEATURE_HYBRID_CPUand have no E- cores,
but
P-cores still use hybrid scaling factor.commit
0fcfc9e51990("cpufreq:intel_pstate: Fix scaling for hybrid-capable systems with disabled E-cores") added support for
such configuration. Here using CPPC nominal freq and perf was compared
to still return hybrid scaling factor.Commit
9b18d536b124("cpufreq:intel_pstate: Use CPPC to get scaling
factors") restructuredhwp_get_cpu_scaling()and added an explicit
check
forX86_FEATURE_HYBRID_CPUand when not set returns core scaling
factor.To address this remove check for
X86_FEATURE_HYBRID_CPUand callintel_pstate_cppc_get_scaling().Ideally this change should be enough. But using CPPC for scaling
factor
results in rounding error, so still doesn't restore the original
behavior.In
intel_pstate_cppc_get_scaling()return core scaling factor when
ACPI CPPC is not present or when CPPC nominal frequency or nominal
performance are invalid.Use
hybrid_scaling_factorfor P-cores when defined for a CPU, if
not
calculate from ACPI CPPC nominal frequency and performance.Fixes 9b18d536b124 ("cpufreq: intel_pstate: Use CPPC to getscaling factors")
Reported-by Henry Tseng <[email protected]>Closes:
https://lore.kernel.org/linux-pm/[email protected]/
Signed-off-by: Srinivas Pandruvada
<[email protected]>
Cc: [email protected]--- drivers/cpufreq/intel_pstate.c | 29 +++++++++++++++----------- --- 1 file changed, 15 insertions(+), 14 deletions(-)drivers/cpufreq/intel_pstate.c +0
-0@@ -421,15 +421,23 @@ static intintel_pstate_cppc_get_scaling(int
cpu){ struct cppc_perf_caps cppc_perf;+ if (
cppc_get_perf_caps(cpu, &cppc_perf)||
!cppc_perf.nominal_freq ||drivers/cpufreq/intel_pstate.c +4
-0+ !cppc_perf.nominal_perf) + goto core_scaling; + + if (cppc_perf.nominal_perf * 100 ==cppc_perf.nominal_freq)
drivers/cpufreq/intel_pstate.c +5
-1+ goto core_scaling; + +if (hybrid_scaling_factor) +return hybrid_scaling_factor; +/* -* Compute the perf-to-frequency scaling factor for the given CPU if
drivers/cpufreq/intel_pstate.c +1
-1-* possible, unless it would be 0. +* Compute the perf-to-frequency scaling factor for the given CPU
drivers/cpufreq/intel_pstate.c +1
-3+* from nominal freq and nominal_perf */ -if (!cppc_get_perf_caps (cpu, &cppc_perf) && - cppc_perf.nominal_perf && cppc_perf.nominal_freq) - return div_u64(cppc_perf.nominal_freq *
KHZ_PER_MHZ,drivers/cpufreq/intel_pstate.c +1
-1- cppc_perf.nominal_perf); + return div_u64(cppc_perf.nominal_freq * KHZ_PER_MHZ,cppc_perf.nominal_perf);
drivers/cpufreq/intel_pstate.c +1
-0+core_scaling:return core_get_scaling (); }drivers/cpufreq/intel_pstate.c static int hwp_get_cpu_scaling(int cpu) · line 2286
Quoted 6 lines
drivers/cpufreq/intel_pstate.c +0
-2@@ -2281,17 +2289,10 @@ static int hwp_get_cpu_scaling(int cpu)*/ if (hybrid_get_cpu_type (cpu) ==INTEL_CPU_TYPE_CORE )return hybrid_scaling_factor; - -return core_get_scaling ();Why is this change necessary or even useful?
This is about E-cores (because P-cores have been covered above) and
ifhybrid_scaling_factoris set, it is known that the processor is hybrid
and E-cores have the "core" scaling factor.Quoted 6 lines
Or is Raptor Lake-E covered by one of the intel_hybrid_scaling_factor[] entries and
hybrid_get_cpu_type(cpu)
doesn't returnINTEL_CPU_TYPE_COREon it? This piece of information
is missing from the changelog.Quoted 3 lines
Raptor Lake-E (Xeon) uses CPU model as Raptor Lake-S, for which there
is already a hardcoded scaling factor in the driver.This piece of information needs to be added to the changelog in the first place because it is key here.
Quoted 6 lines
So this "if" block will enter. But since there is no hybrid CPUID feature is defined,
hybrid_get_cpu_type(cpu)will return 0 for P-core or E-core. Here there
are no E-cores. So need to removecore_get_scaling()as this will return non hybrid factor.Well, what about this:
--- drivers/cpufreq/intel_pstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/cpufreq/intel_pstate.c +1
-1@@ -2279,7 +2279,7 @@ static int hwp_get_cpu_scaling(int cpu)* Return the hybrid scaling factor for P-cores and use the * default core scaling for E-cores. */ -if (hybrid_get_cpu_type (cpu) ==INTEL_CPU_TYPE_CORE ) +if (hybrid_get_cpu_type (cpu) !=INTEL_CPU_TYPE_ATOM )return hybrid_scaling_factor;
Quoted 6 lines
Quoted 4 lines
drivers/cpufreq/intel_pstate.c +0
-0return core_get_scaling ();Or is the original Raptor Lake-S scaling factor unsuitable for Raptor Lake-E?
This will work for RPL-E.
OK
Quoted 3 lines
But the original change also accounted for
core scaling on hybrid. There was some embedded hybrid capable with P core only, used core scaling. Don't find that system details anymore.
It's better to address this one separately IMV.
Quoted 2 lines
But fine, we can live with this change with added Bartlett Lake scaling factor.
OK
Let me send a proper patch for the above change and I assume that there will be a separate patch adding the Bartlett Lake scaling factor.