All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] intel_pstate: prevent max_perf_pct < min_perf_pct
@ 2015-09-04 10:58 Seiichi Ikarashi
  2015-09-07  9:00 ` Chen, Yu C
  0 siblings, 1 reply; 6+ messages in thread
From: Seiichi Ikarashi @ 2015-09-04 10:58 UTC (permalink / raw)
  To: kristen, rafael.j.wysocki; +Cc: linux-pm

Add some value check to prevent a reversal, max_perf_pct < min_perf_pct.

Signed-off-by: Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com>

---
 drivers/cpufreq/intel_pstate.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index fcb929e..03dda19 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -423,6 +423,7 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b,
 
 	limits.max_sysfs_pct = clamp_t(int, input, 0 , 100);
 	limits.max_perf_pct = min(limits.max_policy_pct, limits.max_sysfs_pct);
+	limits.max_perf_pct = max(limits.max_perf_pct, limits.min_perf_pct);
 	limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100));
 
 	if (hwp_active)
@@ -442,6 +443,7 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b,
 
 	limits.min_sysfs_pct = clamp_t(int, input, 0 , 100);
 	limits.min_perf_pct = max(limits.min_policy_pct, limits.min_sysfs_pct);
+	limits.min_perf_pct = min(limits.min_perf_pct, limits.max_perf_pct);
 	limits.min_perf = div_fp(int_tofp(limits.min_perf_pct), int_tofp(100));
 
 	if (hwp_active)

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

end of thread, other threads:[~2015-09-09  4:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-04 10:58 [PATCH] intel_pstate: prevent max_perf_pct < min_perf_pct Seiichi Ikarashi
2015-09-07  9:00 ` Chen, Yu C
2015-09-07 21:46   ` Rafael J. Wysocki
2015-09-07 23:18   ` Seiichi Ikarashi
2015-09-08  7:27     ` Chen, Yu C
2015-09-09  4:27       ` Seiichi Ikarashi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.