diff options
author | Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> | 2015-07-23 02:50:27 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-07-23 14:40:51 -0400 |
commit | 2e5e8fd1ff9d802ab74df1ceaa5243da30491a45 (patch) | |
tree | 17ef07278e16b9ad1fd0ce440725788e05a52db8 | |
parent | 52721d9d3334c1cb1f76219a161084094ec634dc (diff) |
cpupower: Do not change the frequency of offline cpu
Check if the cpu is online before changing the frequency/governor of
the cpu.
Reported-by: Pavaman Subramaniyam <pavsubra@linux.vnet.ibm.com>
Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
Acked-by: Thomas Renninger <trenn@suse.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | tools/power/cpupower/utils/cpufreq-set.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c index f656e585ed45..4e213576381e 100644 --- a/tools/power/cpupower/utils/cpufreq-set.c +++ b/tools/power/cpupower/utils/cpufreq-set.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include "cpufreq.h" | 18 | #include "cpufreq.h" |
19 | #include "helpers/helpers.h" | 19 | #include "helpers/helpers.h" |
20 | #include "helpers/sysfs.h" | ||
20 | 21 | ||
21 | #define NORM_FREQ_LEN 32 | 22 | #define NORM_FREQ_LEN 32 |
22 | 23 | ||
@@ -318,6 +319,9 @@ int cmd_freq_set(int argc, char **argv) | |||
318 | cpufreq_cpu_exists(cpu)) | 319 | cpufreq_cpu_exists(cpu)) |
319 | continue; | 320 | continue; |
320 | 321 | ||
322 | if (sysfs_is_cpu_online(cpu) != 1) | ||
323 | continue; | ||
324 | |||
321 | printf(_("Setting cpu: %d\n"), cpu); | 325 | printf(_("Setting cpu: %d\n"), cpu); |
322 | ret = do_one_cpu(cpu, &new_pol, freq, policychange); | 326 | ret = do_one_cpu(cpu, &new_pol, freq, policychange); |
323 | if (ret) { | 327 | if (ret) { |