Skip to contentSkip to conversation

cpufreq: intel_pstate: Fix cpu->pstate.turbo_freq initialization

PATCH Applied Zhang Rui 2 participants 2 messages Oct 26, 2021

Subsystems (2)
lore
Share & tools
lore

Zhang Rui

author
#0 lore raw

PATCH 1/1 cpufreq: intel_pstate: Fix cpu->pstate.turbo_freq initialization

Fix a problem in active mode that cpu->pstate.turbo_freq is initialized only if HWP-to-frequency scaling factor is refined.

In passive mode, this problem is not exposed, because cpu->pstate.turbo_freq is set again, later in intel_cpufreq_cpu_init()->intel_pstate_get_hwp_cap().

Fixes eb3693f0521e ("cpufreq: intel_pstate: hybrid: CPU-specific scaling factor")
---
 drivers/cpufreq/intel_pstate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/cpufreq/intel_pstate.c +2 -1
index 8c176b7dae41..fc7a429f22d3 100644
@@ -537,7 +537,8 @@ static void intel_pstate_hybrid_hwp_adjust(struct cpudata *cpu)
 	 * scaling factor is too high, so recompute it to make the HWP_CAP
 	 * highest performance correspond to the maximum turbo frequency.
 	 */
-	if (turbo_freq < cpu->pstate.turbo_pstate * scaling) {
+	cpu->pstate.turbo_freq = cpu->pstate.turbo_pstate * scaling;
+	if (turbo_freq < cpu->pstate.turbo_freq) {
 		cpu->pstate.turbo_freq = turbo_freq;
 		scaling = DIV_ROUND_UP(turbo_freq, cpu->pstate.turbo_pstate);
 		cpu->pstate.scaling = scaling;
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw
Quoted 19 lines · Zhang Rui

Fix a problem in active mode that cpu->pstate.turbo_freq is initialized only if HWP-to-frequency scaling factor is refined.

In passive mode, this problem is not exposed, because cpu->pstate.turbo_freq is set again, later in intel_cpufreq_cpu_init()->intel_pstate_get_hwp_cap().

Fixes eb3693f0521e ("cpufreq: intel_pstate: hybrid: CPU-specific scaling factor")
---
 drivers/cpufreq/intel_pstate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/cpufreq/intel_pstate.c +0 -0
index 8c176b7dae41..fc7a429f22d3 100644

drivers/cpufreq/intel_pstate.c static void intel_pstate_hybrid_hwp_adjust(struct cpudata *cpu)

Quoted 10 lines
drivers/cpufreq/intel_pstate.c +2 -2
@@ -537,7 +537,8 @@ static void intel_pstate_hybrid_hwp_adjust(struct cpudata *cpu)
         * scaling factor is too high, so recompute it to make the HWP_CAP
         * highest performance correspond to the maximum turbo frequency.
         */
-       if (turbo_freq < cpu->pstate.turbo_pstate * scaling) {
+       cpu->pstate.turbo_freq = cpu->pstate.turbo_pstate * scaling;
+       if (turbo_freq < cpu->pstate.turbo_freq) {
                cpu->pstate.turbo_freq = turbo_freq;
                scaling = DIV_ROUND_UP(turbo_freq, cpu->pstate.turbo_pstate);
                cpu->pstate.scaling = scaling;
--

Applied as 5.16 material, thanks!