summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/power/cpupower/debug/i386/dump_psb.c2
-rw-r--r--tools/power/cpupower/man/cpupower-idle-set.14
-rw-r--r--tools/power/cpupower/utils/cpufreq-info.c30
-rw-r--r--tools/power/cpupower/utils/cpufreq-set.c10
-rw-r--r--tools/power/cpupower/utils/cpuidle-info.c4
-rw-r--r--tools/power/cpupower/utils/cpuidle-set.c33
-rw-r--r--tools/power/cpupower/utils/cpupower-info.c4
-rw-r--r--tools/power/cpupower/utils/cpupower-set.c2
-rw-r--r--tools/power/cpupower/utils/helpers/topology.c23
-rw-r--r--tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c9
10 files changed, 70 insertions, 51 deletions
diff --git a/tools/power/cpupower/debug/i386/dump_psb.c b/tools/power/cpupower/debug/i386/dump_psb.c
index 8d6a47514253..2c768cf70128 100644
--- a/tools/power/cpupower/debug/i386/dump_psb.c
+++ b/tools/power/cpupower/debug/i386/dump_psb.c
@@ -134,7 +134,7 @@ next_one:
134} 134}
135 135
136static struct option info_opts[] = { 136static struct option info_opts[] = {
137 {.name = "numpst", .has_arg=no_argument, .flag=NULL, .val='n'}, 137 {"numpst", no_argument, NULL, 'n'},
138}; 138};
139 139
140void print_help(void) 140void print_help(void)
diff --git a/tools/power/cpupower/man/cpupower-idle-set.1 b/tools/power/cpupower/man/cpupower-idle-set.1
index 3e6799d7a79f..580c4e3ea92a 100644
--- a/tools/power/cpupower/man/cpupower-idle-set.1
+++ b/tools/power/cpupower/man/cpupower-idle-set.1
@@ -20,7 +20,9 @@ Disable a specific processor sleep state.
20Enable a specific processor sleep state. 20Enable a specific processor sleep state.
21.TP 21.TP
22\fB\-D\fR \fB\-\-disable-by-latency\fR <LATENCY> 22\fB\-D\fR \fB\-\-disable-by-latency\fR <LATENCY>
23Disable all idle states with a equal or higher latency than <LATENCY> 23Disable all idle states with a equal or higher latency than <LATENCY>.
24
25Enable all idle states with a latency lower than <LATENCY>.
24.TP 26.TP
25\fB\-E\fR \fB\-\-enable-all\fR 27\fB\-E\fR \fB\-\-enable-all\fR
26Enable all idle states if not enabled already. 28Enable all idle states if not enabled already.
diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c
index b4b90a97662c..0e6764330241 100644
--- a/tools/power/cpupower/utils/cpufreq-info.c
+++ b/tools/power/cpupower/utils/cpufreq-info.c
@@ -536,21 +536,21 @@ static int get_latency(unsigned int cpu, unsigned int human)
536} 536}
537 537
538static struct option info_opts[] = { 538static struct option info_opts[] = {
539 { .name = "debug", .has_arg = no_argument, .flag = NULL, .val = 'e'}, 539 {"debug", no_argument, NULL, 'e'},
540 { .name = "boost", .has_arg = no_argument, .flag = NULL, .val = 'b'}, 540 {"boost", no_argument, NULL, 'b'},
541 { .name = "freq", .has_arg = no_argument, .flag = NULL, .val = 'f'}, 541 {"freq", no_argument, NULL, 'f'},
542 { .name = "hwfreq", .has_arg = no_argument, .flag = NULL, .val = 'w'}, 542 {"hwfreq", no_argument, NULL, 'w'},
543 { .name = "hwlimits", .has_arg = no_argument, .flag = NULL, .val = 'l'}, 543 {"hwlimits", no_argument, NULL, 'l'},
544 { .name = "driver", .has_arg = no_argument, .flag = NULL, .val = 'd'}, 544 {"driver", no_argument, NULL, 'd'},
545 { .name = "policy", .has_arg = no_argument, .flag = NULL, .val = 'p'}, 545 {"policy", no_argument, NULL, 'p'},
546 { .name = "governors", .has_arg = no_argument, .flag = NULL, .val = 'g'}, 546 {"governors", no_argument, NULL, 'g'},
547 { .name = "related-cpus", .has_arg = no_argument, .flag = NULL, .val = 'r'}, 547 {"related-cpus", no_argument, NULL, 'r'},
548 { .name = "affected-cpus",.has_arg = no_argument, .flag = NULL, .val = 'a'}, 548 {"affected-cpus", no_argument, NULL, 'a'},
549 { .name = "stats", .has_arg = no_argument, .flag = NULL, .val = 's'}, 549 {"stats", no_argument, NULL, 's'},
550 { .name = "latency", .has_arg = no_argument, .flag = NULL, .val = 'y'}, 550 {"latency", no_argument, NULL, 'y'},
551 { .name = "proc", .has_arg = no_argument, .flag = NULL, .val = 'o'}, 551 {"proc", no_argument, NULL, 'o'},
552 { .name = "human", .has_arg = no_argument, .flag = NULL, .val = 'm'}, 552 {"human", no_argument, NULL, 'm'},
553 { .name = "no-rounding", .has_arg = no_argument, .flag = NULL, .val = 'n'}, 553 {"no-rounding", no_argument, NULL, 'n'},
554 { }, 554 { },
555}; 555};
556 556
diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c
index 4e213576381e..0fbd1a22c0a9 100644
--- a/tools/power/cpupower/utils/cpufreq-set.c
+++ b/tools/power/cpupower/utils/cpufreq-set.c
@@ -22,11 +22,11 @@
22#define NORM_FREQ_LEN 32 22#define NORM_FREQ_LEN 32
23 23
24static struct option set_opts[] = { 24static struct option set_opts[] = {
25 { .name = "min", .has_arg = required_argument, .flag = NULL, .val = 'd'}, 25 {"min", required_argument, NULL, 'd'},
26 { .name = "max", .has_arg = required_argument, .flag = NULL, .val = 'u'}, 26 {"max", required_argument, NULL, 'u'},
27 { .name = "governor", .has_arg = required_argument, .flag = NULL, .val = 'g'}, 27 {"governor", required_argument, NULL, 'g'},
28 { .name = "freq", .has_arg = required_argument, .flag = NULL, .val = 'f'}, 28 {"freq", required_argument, NULL, 'f'},
29 { .name = "related", .has_arg = no_argument, .flag = NULL, .val='r'}, 29 {"related", no_argument, NULL, 'r'},
30 { }, 30 { },
31}; 31};
32 32
diff --git a/tools/power/cpupower/utils/cpuidle-info.c b/tools/power/cpupower/utils/cpuidle-info.c
index 75e66de7e7a7..750c1d82c3f7 100644
--- a/tools/power/cpupower/utils/cpuidle-info.c
+++ b/tools/power/cpupower/utils/cpuidle-info.c
@@ -126,8 +126,8 @@ static void proc_cpuidle_cpu_output(unsigned int cpu)
126} 126}
127 127
128static struct option info_opts[] = { 128static struct option info_opts[] = {
129 { .name = "silent", .has_arg = no_argument, .flag = NULL, .val = 's'}, 129 {"silent", no_argument, NULL, 's'},
130 { .name = "proc", .has_arg = no_argument, .flag = NULL, .val = 'o'}, 130 {"proc", no_argument, NULL, 'o'},
131 { }, 131 { },
132}; 132};
133 133
diff --git a/tools/power/cpupower/utils/cpuidle-set.c b/tools/power/cpupower/utils/cpuidle-set.c
index d45d8d775c02..d6b6ae44b8c2 100644
--- a/tools/power/cpupower/utils/cpuidle-set.c
+++ b/tools/power/cpupower/utils/cpuidle-set.c
@@ -13,15 +13,11 @@
13#include "helpers/sysfs.h" 13#include "helpers/sysfs.h"
14 14
15static struct option info_opts[] = { 15static struct option info_opts[] = {
16 { .name = "disable", 16 {"disable", required_argument, NULL, 'd'},
17 .has_arg = required_argument, .flag = NULL, .val = 'd'}, 17 {"enable", required_argument, NULL, 'e'},
18 { .name = "enable", 18 {"disable-by-latency", required_argument, NULL, 'D'},
19 .has_arg = required_argument, .flag = NULL, .val = 'e'}, 19 {"enable-all", no_argument, NULL, 'E'},
20 { .name = "disable-by-latency", 20 { },
21 .has_arg = required_argument, .flag = NULL, .val = 'D'},
22 { .name = "enable-all",
23 .has_arg = no_argument, .flag = NULL, .val = 'E'},
24 { },
25}; 21};
26 22
27 23
@@ -148,14 +144,21 @@ int cmd_idle_set(int argc, char **argv)
148 (cpu, idlestate); 144 (cpu, idlestate);
149 state_latency = sysfs_get_idlestate_latency 145 state_latency = sysfs_get_idlestate_latency
150 (cpu, idlestate); 146 (cpu, idlestate);
151 printf("CPU: %u - idlestate %u - state_latency: %llu - latency: %llu\n", 147 if (disabled == 1) {
152 cpu, idlestate, state_latency, latency); 148 if (latency > state_latency){
153 if (disabled == 1 || latency > state_latency) 149 ret = sysfs_idlestate_disable
150 (cpu, idlestate, 0);
151 if (ret == 0)
152 printf(_("Idlestate %u enabled on CPU %u\n"), idlestate, cpu);
153 }
154 continue; 154 continue;
155 ret = sysfs_idlestate_disable 155 }
156 (cpu, idlestate, 1); 156 if (latency <= state_latency){
157 if (ret == 0) 157 ret = sysfs_idlestate_disable
158 (cpu, idlestate, 1);
159 if (ret == 0)
158 printf(_("Idlestate %u disabled on CPU %u\n"), idlestate, cpu); 160 printf(_("Idlestate %u disabled on CPU %u\n"), idlestate, cpu);
161 }
159 } 162 }
160 break; 163 break;
161 case 'E': 164 case 'E':
diff --git a/tools/power/cpupower/utils/cpupower-info.c b/tools/power/cpupower/utils/cpupower-info.c
index 136d979e9586..10299f2e9d2a 100644
--- a/tools/power/cpupower/utils/cpupower-info.c
+++ b/tools/power/cpupower/utils/cpupower-info.c
@@ -17,8 +17,8 @@
17#include "helpers/sysfs.h" 17#include "helpers/sysfs.h"
18 18
19static struct option set_opts[] = { 19static struct option set_opts[] = {
20 { .name = "perf-bias", .has_arg = optional_argument, .flag = NULL, .val = 'b'}, 20 {"perf-bias", optional_argument, NULL, 'b'},
21 { }, 21 { },
22}; 22};
23 23
24static void print_wrong_arg_exit(void) 24static void print_wrong_arg_exit(void)
diff --git a/tools/power/cpupower/utils/cpupower-set.c b/tools/power/cpupower/utils/cpupower-set.c
index 573c75f8e3f5..3e6f374f8dd7 100644
--- a/tools/power/cpupower/utils/cpupower-set.c
+++ b/tools/power/cpupower/utils/cpupower-set.c
@@ -18,7 +18,7 @@
18#include "helpers/bitmask.h" 18#include "helpers/bitmask.h"
19 19
20static struct option set_opts[] = { 20static struct option set_opts[] = {
21 { .name = "perf-bias", .has_arg = required_argument, .flag = NULL, .val = 'b'}, 21 {"perf-bias", required_argument, NULL, 'b'},
22 { }, 22 { },
23}; 23};
24 24
diff --git a/tools/power/cpupower/utils/helpers/topology.c b/tools/power/cpupower/utils/helpers/topology.c
index cea398c176e7..9cbb7fd75171 100644
--- a/tools/power/cpupower/utils/helpers/topology.c
+++ b/tools/power/cpupower/utils/helpers/topology.c
@@ -73,18 +73,22 @@ int get_cpu_topology(struct cpupower_topology *cpu_top)
73 for (cpu = 0; cpu < cpus; cpu++) { 73 for (cpu = 0; cpu < cpus; cpu++) {
74 cpu_top->core_info[cpu].cpu = cpu; 74 cpu_top->core_info[cpu].cpu = cpu;
75 cpu_top->core_info[cpu].is_online = sysfs_is_cpu_online(cpu); 75 cpu_top->core_info[cpu].is_online = sysfs_is_cpu_online(cpu);
76 if (!cpu_top->core_info[cpu].is_online)
77 continue;
78 if(sysfs_topology_read_file( 76 if(sysfs_topology_read_file(
79 cpu, 77 cpu,
80 "physical_package_id", 78 "physical_package_id",
81 &(cpu_top->core_info[cpu].pkg)) < 0) 79 &(cpu_top->core_info[cpu].pkg)) < 0) {
82 return -1; 80 cpu_top->core_info[cpu].pkg = -1;
81 cpu_top->core_info[cpu].core = -1;
82 continue;
83 }
83 if(sysfs_topology_read_file( 84 if(sysfs_topology_read_file(
84 cpu, 85 cpu,
85 "core_id", 86 "core_id",
86 &(cpu_top->core_info[cpu].core)) < 0) 87 &(cpu_top->core_info[cpu].core)) < 0) {
87 return -1; 88 cpu_top->core_info[cpu].pkg = -1;
89 cpu_top->core_info[cpu].core = -1;
90 continue;
91 }
88 } 92 }
89 93
90 qsort(cpu_top->core_info, cpus, sizeof(struct cpuid_core_info), 94 qsort(cpu_top->core_info, cpus, sizeof(struct cpuid_core_info),
@@ -95,12 +99,15 @@ int get_cpu_topology(struct cpupower_topology *cpu_top)
95 done by pkg value. */ 99 done by pkg value. */
96 last_pkg = cpu_top->core_info[0].pkg; 100 last_pkg = cpu_top->core_info[0].pkg;
97 for(cpu = 1; cpu < cpus; cpu++) { 101 for(cpu = 1; cpu < cpus; cpu++) {
98 if(cpu_top->core_info[cpu].pkg != last_pkg) { 102 if (cpu_top->core_info[cpu].pkg != last_pkg &&
103 cpu_top->core_info[cpu].pkg != -1) {
104
99 last_pkg = cpu_top->core_info[cpu].pkg; 105 last_pkg = cpu_top->core_info[cpu].pkg;
100 cpu_top->pkgs++; 106 cpu_top->pkgs++;
101 } 107 }
102 } 108 }
103 cpu_top->pkgs++; 109 if (!cpu_top->core_info[0].pkg == -1)
110 cpu_top->pkgs++;
104 111
105 /* Intel's cores count is not consecutively numbered, there may 112 /* Intel's cores count is not consecutively numbered, there may
106 * be a core_id of 3, but none of 2. Assume there always is 0 113 * be a core_id of 3, but none of 2. Assume there always is 0
diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
index c4bae9203a69..05f953f0f0a0 100644
--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
+++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
@@ -143,6 +143,9 @@ void print_results(int topology_depth, int cpu)
143 /* Be careful CPUs may got resorted for pkg value do not just use cpu */ 143 /* Be careful CPUs may got resorted for pkg value do not just use cpu */
144 if (!bitmask_isbitset(cpus_chosen, cpu_top.core_info[cpu].cpu)) 144 if (!bitmask_isbitset(cpus_chosen, cpu_top.core_info[cpu].cpu))
145 return; 145 return;
146 if (!cpu_top.core_info[cpu].is_online &&
147 cpu_top.core_info[cpu].pkg == -1)
148 return;
146 149
147 if (topology_depth > 2) 150 if (topology_depth > 2)
148 printf("%4d|", cpu_top.core_info[cpu].pkg); 151 printf("%4d|", cpu_top.core_info[cpu].pkg);
@@ -191,7 +194,8 @@ void print_results(int topology_depth, int cpu)
191 * It's up to the monitor plug-in to check .is_online, this one 194 * It's up to the monitor plug-in to check .is_online, this one
192 * is just for additional info. 195 * is just for additional info.
193 */ 196 */
194 if (!cpu_top.core_info[cpu].is_online) { 197 if (!cpu_top.core_info[cpu].is_online &&
198 cpu_top.core_info[cpu].pkg != -1) {
195 printf(_(" *is offline\n")); 199 printf(_(" *is offline\n"));
196 return; 200 return;
197 } else 201 } else
@@ -388,6 +392,9 @@ int cmd_monitor(int argc, char **argv)
388 return EXIT_FAILURE; 392 return EXIT_FAILURE;
389 } 393 }
390 394
395 if (!cpu_top.core_info[0].is_online)
396 printf("WARNING: at least one cpu is offline\n");
397
391 /* Default is: monitor all CPUs */ 398 /* Default is: monitor all CPUs */
392 if (bitmask_isallclear(cpus_chosen)) 399 if (bitmask_isallclear(cpus_chosen))
393 bitmask_setall(cpus_chosen); 400 bitmask_setall(cpus_chosen);