Skip to contentSkip to conversation

cpufreq: intel_pstate: Fix energy_performance_preference for passive

PATCH Applied Tero Kristo 2 participants 2 messages Jun 21, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: intel_pstate: Fix energy_performance_preference for passive

If the intel_pstate driver is set to passive mode, then writing the same value to the energy_performance_preference sysfs twice will fail. This is caused by the wrong return value used (index of the matched energy_perf_string), instead of the length of the passed in parameter. Fix by forcing the internal return value to zero when the same preference is passed in by user. This same issue is not present when active mode is used for the driver.

Fixes f6ebbcf08f37 ("cpufreq: intel_pstate: Implement passive mode with HWP enabled")
---
 drivers/cpufreq/intel_pstate.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/cpufreq/intel_pstate.c +2 -0
index 2548ec92faa2..f29182512b98 100644
@@ -824,6 +824,8 @@ static ssize_t store_energy_performance_preference(
 			err = cpufreq_start_governor(policy);
 			if (!ret)
 				ret = err;
+		} else {
+			ret = 0;
 		}
 	}
 
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 21 lines · Tero Kristo

If the intel_pstate driver is set to passive mode, then writing the same value to the energy_performance_preference sysfs twice will fail. This is caused by the wrong return value used (index of the matched energy_perf_string), instead of the length of the passed in parameter. Fix by forcing the internal return value to zero when the same preference is passed in by user. This same issue is not present when active mode is used for the driver.

Fixes f6ebbcf08f37 ("cpufreq: intel_pstate: Implement passive mode with HWP enabled")
---
 drivers/cpufreq/intel_pstate.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/cpufreq/intel_pstate.c +0 -0
index 2548ec92faa2..f29182512b98 100644

drivers/cpufreq/intel_pstate.c static ssize_t store_energy_performance_preference(

Quoted 9 lines
drivers/cpufreq/intel_pstate.c +2 -1
@@ -824,6 +824,8 @@ static ssize_t store_energy_performance_preference(
                        err = cpufreq_start_governor(policy);
                        if (!ret)
                                ret = err;
+               } else {
+                       ret = 0;
                }
        }
 
--

Applied as 6.5 material, thanks!