The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] cpufreq: intel_pstate: Fix energy_performance_preference for passive
@ 2023-06-21  6:58 Tero Kristo
  2023-06-21 17:44 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Tero Kristo @ 2023-06-21  6:58 UTC (permalink / raw)
  To: rafael, viresh.kumar
  Cc: srinivas.pandruvada, lenb, linux-pm, linux-kernel, Niklas Neronin

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")
Reported-by: Niklas Neronin <niklas.neronin@intel.com>
Signed-off-by: Tero Kristo <tero.kristo@linux.intel.com>
---
 drivers/cpufreq/intel_pstate.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 2548ec92faa2..f29182512b98 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -824,6 +824,8 @@ static ssize_t store_energy_performance_preference(
 			err = cpufreq_start_governor(policy);
 			if (!ret)
 				ret = err;
+		} else {
+			ret = 0;
 		}
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-21 17:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-21  6:58 [PATCH] cpufreq: intel_pstate: Fix energy_performance_preference for passive Tero Kristo
2023-06-21 17:44 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox