diff options
Diffstat (limited to 'tools/power/cpupower')
| -rw-r--r-- | tools/power/cpupower/man/cpupower-idle-info.1 | 3 | ||||
| -rw-r--r-- | tools/power/cpupower/man/cpupower-idle-set.1 | 71 | ||||
| -rw-r--r-- | tools/power/cpupower/utils/cpupower-set.c | 6 | ||||
| -rw-r--r-- | tools/power/cpupower/utils/helpers/sysfs.c | 4 |
4 files changed, 78 insertions, 6 deletions
diff --git a/tools/power/cpupower/man/cpupower-idle-info.1 b/tools/power/cpupower/man/cpupower-idle-info.1 index 4178effd9e99..7b3646adb92f 100644 --- a/tools/power/cpupower/man/cpupower-idle-info.1 +++ b/tools/power/cpupower/man/cpupower-idle-info.1 | |||
| @@ -87,4 +87,5 @@ Thomas Renninger <trenn@suse.de> | |||
| 87 | .fi | 87 | .fi |
| 88 | .SH "SEE ALSO" | 88 | .SH "SEE ALSO" |
| 89 | .LP | 89 | .LP |
| 90 | cpupower(1), cpupower\-monitor(1), cpupower\-info(1), cpupower\-set(1) | 90 | cpupower(1), cpupower\-monitor(1), cpupower\-info(1), cpupower\-set(1), |
| 91 | cpupower\-idle\-set(1) | ||
diff --git a/tools/power/cpupower/man/cpupower-idle-set.1 b/tools/power/cpupower/man/cpupower-idle-set.1 new file mode 100644 index 000000000000..6b1607272a5b --- /dev/null +++ b/tools/power/cpupower/man/cpupower-idle-set.1 | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | .TH "CPUPOWER-IDLE-SET" "1" "0.1" "" "cpupower Manual" | ||
| 2 | .SH "NAME" | ||
| 3 | .LP | ||
| 4 | cpupower idle\-set \- Utility to set cpu idle state specific kernel options | ||
| 5 | .SH "SYNTAX" | ||
| 6 | .LP | ||
| 7 | cpupower [ \-c cpulist ] idle\-info [\fIoptions\fP] | ||
| 8 | .SH "DESCRIPTION" | ||
| 9 | .LP | ||
| 10 | The cpupower idle\-set subcommand allows to set cpu idle, also called cpu | ||
| 11 | sleep state, specific options offered by the kernel. One example is disabling | ||
| 12 | sleep states. This can be handy for power vs performance tuning. | ||
| 13 | .SH "OPTIONS" | ||
| 14 | .LP | ||
| 15 | .TP | ||
| 16 | \fB\-d\fR \fB\-\-disable\fR | ||
| 17 | Disable a specific processor sleep state. | ||
| 18 | .TP | ||
| 19 | \fB\-e\fR \fB\-\-enable\fR | ||
| 20 | Enable a specific processor sleep state. | ||
| 21 | |||
| 22 | .SH "REMARKS" | ||
| 23 | .LP | ||
| 24 | Cpuidle Governors Policy on Disabling Sleep States | ||
| 25 | |||
| 26 | .RS 4 | ||
| 27 | Depending on the used cpuidle governor, implementing the kernel policy | ||
| 28 | how to choose sleep states, subsequent sleep states on this core, might get | ||
| 29 | disabled as well. | ||
| 30 | |||
| 31 | There are two cpuidle governors ladder and menu. While the ladder | ||
| 32 | governor is always available, if CONFIG_CPU_IDLE is selected, the | ||
| 33 | menu governor additionally requires CONFIG_NO_HZ. | ||
| 34 | |||
| 35 | The behavior and the effect of the disable variable depends on the | ||
| 36 | implementation of a particular governor. In the ladder governor, for | ||
| 37 | example, it is not coherent, i.e. if one is disabling a light state, | ||
| 38 | then all deeper states are disabled as well. Likewise, if one enables a | ||
| 39 | deep state but a lighter state still is disabled, then this has no effect. | ||
| 40 | .RE | ||
| 41 | .LP | ||
| 42 | Disabling the Lightest Sleep State may not have any Affect | ||
| 43 | |||
| 44 | .RS 4 | ||
| 45 | If criteria are not met to enter deeper sleep states and the lightest sleep | ||
| 46 | state is chosen when idle, the kernel may still enter this sleep state, | ||
| 47 | irrespective of whether it is disabled or not. This is also reflected in | ||
| 48 | the usage count of the disabled sleep state when using the cpupower idle-info | ||
| 49 | command. | ||
| 50 | .RE | ||
| 51 | .LP | ||
| 52 | Selecting specific CPU Cores | ||
| 53 | |||
| 54 | .RS 4 | ||
| 55 | By default processor sleep states of all CPU cores are set. Please refer | ||
| 56 | to the cpupower(1) manpage in the \-\-cpu option section how to disable | ||
| 57 | C-states of specific cores. | ||
| 58 | .RE | ||
| 59 | .SH "FILES" | ||
| 60 | .nf | ||
| 61 | \fI/sys/devices/system/cpu/cpu*/cpuidle/state*\fP | ||
| 62 | \fI/sys/devices/system/cpu/cpuidle/*\fP | ||
| 63 | .fi | ||
| 64 | .SH "AUTHORS" | ||
| 65 | .nf | ||
| 66 | Thomas Renninger <trenn@suse.de> | ||
| 67 | .fi | ||
| 68 | .SH "SEE ALSO" | ||
| 69 | .LP | ||
| 70 | cpupower(1), cpupower\-monitor(1), cpupower\-info(1), cpupower\-set(1), | ||
| 71 | cpupower\-idle\-info(1) | ||
diff --git a/tools/power/cpupower/utils/cpupower-set.c b/tools/power/cpupower/utils/cpupower-set.c index dc4de3762111..bcf1d2f0b791 100644 --- a/tools/power/cpupower/utils/cpupower-set.c +++ b/tools/power/cpupower/utils/cpupower-set.c | |||
| @@ -18,9 +18,9 @@ | |||
| 18 | #include "helpers/bitmask.h" | 18 | #include "helpers/bitmask.h" |
| 19 | 19 | ||
| 20 | static struct option set_opts[] = { | 20 | static struct option set_opts[] = { |
| 21 | { .name = "perf-bias", .has_arg = optional_argument, .flag = NULL, .val = 'b'}, | 21 | { .name = "perf-bias", .has_arg = required_argument, .flag = NULL, .val = 'b'}, |
| 22 | { .name = "sched-mc", .has_arg = optional_argument, .flag = NULL, .val = 'm'}, | 22 | { .name = "sched-mc", .has_arg = required_argument, .flag = NULL, .val = 'm'}, |
| 23 | { .name = "sched-smt", .has_arg = optional_argument, .flag = NULL, .val = 's'}, | 23 | { .name = "sched-smt", .has_arg = required_argument, .flag = NULL, .val = 's'}, |
| 24 | { }, | 24 | { }, |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
diff --git a/tools/power/cpupower/utils/helpers/sysfs.c b/tools/power/cpupower/utils/helpers/sysfs.c index 5cdc600e8152..851c7a16ca49 100644 --- a/tools/power/cpupower/utils/helpers/sysfs.c +++ b/tools/power/cpupower/utils/helpers/sysfs.c | |||
| @@ -278,7 +278,7 @@ static char *sysfs_idlestate_get_one_string(unsigned int cpu, | |||
| 278 | int sysfs_is_idlestate_disabled(unsigned int cpu, | 278 | int sysfs_is_idlestate_disabled(unsigned int cpu, |
| 279 | unsigned int idlestate) | 279 | unsigned int idlestate) |
| 280 | { | 280 | { |
| 281 | if (sysfs_get_idlestate_count(cpu) < idlestate) | 281 | if (sysfs_get_idlestate_count(cpu) <= idlestate) |
| 282 | return -1; | 282 | return -1; |
| 283 | 283 | ||
| 284 | if (!sysfs_idlestate_file_exists(cpu, idlestate, | 284 | if (!sysfs_idlestate_file_exists(cpu, idlestate, |
| @@ -303,7 +303,7 @@ int sysfs_idlestate_disable(unsigned int cpu, | |||
| 303 | char value[SYSFS_PATH_MAX]; | 303 | char value[SYSFS_PATH_MAX]; |
| 304 | int bytes_written; | 304 | int bytes_written; |
| 305 | 305 | ||
| 306 | if (sysfs_get_idlestate_count(cpu) < idlestate) | 306 | if (sysfs_get_idlestate_count(cpu) <= idlestate) |
| 307 | return -1; | 307 | return -1; |
| 308 | 308 | ||
| 309 | if (!sysfs_idlestate_file_exists(cpu, idlestate, | 309 | if (!sysfs_idlestate_file_exists(cpu, idlestate, |
