]> git.baikalelectronics.ru Git - kernel.git/commit
intel_pstate: Fix user input of min/max to legal policy region
authorChen Yu <yu.c.chen@intel.com>
Wed, 9 Sep 2015 10:27:31 +0000 (18:27 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 9 Sep 2015 20:55:23 +0000 (22:55 +0200)
commitf9d5a65e8f27f29d5e35bfeaa33f961dd7bd6f0a
treea525f784c4a857f55c09d6dc8eee594ea042cffb
parenta21bce7d2fc73d5c035f7b7a2618d56ecc2f7965
intel_pstate: Fix user input of min/max to legal policy region

In current code, max_perf_pct might be smaller than min_perf_pct
by improper user input:

$ grep . /sys/devices/system/cpu/intel_pstate/m*_perf_pct
/sys/devices/system/cpu/intel_pstate/max_perf_pct:100
/sys/devices/system/cpu/intel_pstate/min_perf_pct:100

$ echo 80 > /sys/devices/system/cpu/intel_pstate/max_perf_pct

$ grep . /sys/devices/system/cpu/intel_pstate/m*_perf_pct
/sys/devices/system/cpu/intel_pstate/max_perf_pct:80
/sys/devices/system/cpu/intel_pstate/min_perf_pct:100

Fix this problem by 2 steps:
 1. Normalize the user input to [min_policy, max_policy].
 2. Make sure max_perf_pct>=min_perf_pct, suggested by Seiichi Ikarashi.

Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Acked-by: Kristen Carlson Accardi <kristen@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/intel_pstate.c