diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-14 13:30:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-14 13:30:06 -0400 |
commit | 9352ca585b2ac7b67d2119b9386573b2a4c0ef4b (patch) | |
tree | 6776d57f6890c5cb29787c3f2bac99213da95d5e /tools | |
parent | 9bc446100334dbbc14eb3757274ef08746c3f9bd (diff) | |
parent | b444e1aa3e48e13aea22162918bd6140c85142de (diff) |
Merge tag 'pm-5.1-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull more power management updates from Rafael Wysocki:
"These are mostly fixes and cleanups on top of the previously merged
power management material for 5.1-rc1 with one cpupower utility update
that wasn't pushed earlier due to unfortunate timing.
Specifics:
- Fix registration of new cpuidle governors partially broken during
the 5.0 development cycle by mistake (Rafael Wysocki).
- Avoid integer overflows in the menu cpuidle governor by making it
discard the overflowing data points upfront (Rafael Wysocki).
- Fix minor mistake in the recent update of the iowait boost
computation in the intel_pstate driver (Rafael Wysocki).
- Drop incorrect __init annotation from one function in the pxa2xx
cpufreq driver (Arnd Bergmann).
- Fix the operating performance points (OPP) framework initialization
for devices in multiple power domains if only one of them is
scalable (Rajendra Nayak).
- Fix mistake in dev_pm_opp_set_rate() which causes it to skip
updating the performance state if the new frequency is the same as
the old one (Viresh Kumar).
- Rework the cancellation of wakeup source timers to avoid potential
issues with it and do some cleanups unlocked by that change (Viresh
Kumar, Rafael Wysocki).
- Clean up the code computing the active/suspended time of devices in
the PM-runtime framework after recent changes (Ulf Hansson).
- Make the power management infrastructure code use pr_fmt()
consistently (Joe Perches).
- Clean up the generic power domains (genpd) framework somewhat
(Aisheng Dong).
- Improve kerneldoc comments for two functions in the cpufreq core
(Rafael Wysocki).
- Fix typo in a PM QoS file description comment (Aisheng Dong).
- Update the handling of CPU boost frequencies in the cpupower
utility (Abhishek Goel)"
* tag 'pm-5.1-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
cpuidle: governor: Add new governors to cpuidle_governors again
cpufreq: intel_pstate: Fix up iowait_boost computation
PM / OPP: Update performance state when freq == old_freq
PM / wakeup: Drop wakeup_source_drop()
PM / wakeup: Rework wakeup source timer cancellation
PM / domains: Remove one unnecessary blank line
PM / Domains: Return early for all errors in _genpd_power_off()
PM / Domains: Improve warn for multiple states but no governor
OPP: Fix handling of multiple power domains
PM / QoS: Fix typo in file description
cpufreq: pxa2xx: remove incorrect __init annotation
PM-runtime: Call pm_runtime_active|suspended_time() from sysfs
PM-runtime: Consolidate code to get active/suspended time
PM: Add and use pr_fmt()
cpufreq: Improve kerneldoc comments for cpufreq_cpu_get/put()
cpuidle: menu: Avoid overflows when computing variance
tools/power/cpupower: Display boost frequency separately
Diffstat (limited to 'tools')
-rw-r--r-- | tools/power/cpupower/lib/cpufreq.c | 19 | ||||
-rw-r--r-- | tools/power/cpupower/lib/cpufreq.h | 16 | ||||
-rw-r--r-- | tools/power/cpupower/utils/cpufreq-info.c | 42 |
3 files changed, 50 insertions, 27 deletions
diff --git a/tools/power/cpupower/lib/cpufreq.c b/tools/power/cpupower/lib/cpufreq.c index 0c0f3e3f0d80..80650497fb80 100644 --- a/tools/power/cpupower/lib/cpufreq.c +++ b/tools/power/cpupower/lib/cpufreq.c | |||
@@ -333,17 +333,20 @@ void cpufreq_put_available_governors(struct cpufreq_available_governors *any) | |||
333 | } | 333 | } |
334 | 334 | ||
335 | 335 | ||
336 | struct cpufreq_available_frequencies | 336 | struct cpufreq_frequencies |
337 | *cpufreq_get_available_frequencies(unsigned int cpu) | 337 | *cpufreq_get_frequencies(const char *type, unsigned int cpu) |
338 | { | 338 | { |
339 | struct cpufreq_available_frequencies *first = NULL; | 339 | struct cpufreq_frequencies *first = NULL; |
340 | struct cpufreq_available_frequencies *current = NULL; | 340 | struct cpufreq_frequencies *current = NULL; |
341 | char one_value[SYSFS_PATH_MAX]; | 341 | char one_value[SYSFS_PATH_MAX]; |
342 | char linebuf[MAX_LINE_LEN]; | 342 | char linebuf[MAX_LINE_LEN]; |
343 | char fname[MAX_LINE_LEN]; | ||
343 | unsigned int pos, i; | 344 | unsigned int pos, i; |
344 | unsigned int len; | 345 | unsigned int len; |
345 | 346 | ||
346 | len = sysfs_cpufreq_read_file(cpu, "scaling_available_frequencies", | 347 | snprintf(fname, MAX_LINE_LEN, "scaling_%s_frequencies", type); |
348 | |||
349 | len = sysfs_cpufreq_read_file(cpu, fname, | ||
347 | linebuf, sizeof(linebuf)); | 350 | linebuf, sizeof(linebuf)); |
348 | if (len == 0) | 351 | if (len == 0) |
349 | return NULL; | 352 | return NULL; |
@@ -389,9 +392,9 @@ struct cpufreq_available_frequencies | |||
389 | return NULL; | 392 | return NULL; |
390 | } | 393 | } |
391 | 394 | ||
392 | void cpufreq_put_available_frequencies(struct cpufreq_available_frequencies | 395 | void cpufreq_put_frequencies(struct cpufreq_frequencies *any) |
393 | *any) { | 396 | { |
394 | struct cpufreq_available_frequencies *tmp, *next; | 397 | struct cpufreq_frequencies *tmp, *next; |
395 | 398 | ||
396 | if (!any) | 399 | if (!any) |
397 | return; | 400 | return; |
diff --git a/tools/power/cpupower/lib/cpufreq.h b/tools/power/cpupower/lib/cpufreq.h index 60beaf5ed2ea..775738269cbf 100644 --- a/tools/power/cpupower/lib/cpufreq.h +++ b/tools/power/cpupower/lib/cpufreq.h | |||
@@ -28,10 +28,10 @@ struct cpufreq_available_governors { | |||
28 | struct cpufreq_available_governors *first; | 28 | struct cpufreq_available_governors *first; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | struct cpufreq_available_frequencies { | 31 | struct cpufreq_frequencies { |
32 | unsigned long frequency; | 32 | unsigned long frequency; |
33 | struct cpufreq_available_frequencies *next; | 33 | struct cpufreq_frequencies *next; |
34 | struct cpufreq_available_frequencies *first; | 34 | struct cpufreq_frequencies *first; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | 37 | ||
@@ -129,14 +129,14 @@ void cpufreq_put_available_governors( | |||
129 | * | 129 | * |
130 | * Only present on _some_ ->target() cpufreq drivers. For information purposes | 130 | * Only present on _some_ ->target() cpufreq drivers. For information purposes |
131 | * only. Please free allocated memory by calling | 131 | * only. Please free allocated memory by calling |
132 | * cpufreq_put_available_frequencies after use. | 132 | * cpufreq_put_frequencies after use. |
133 | */ | 133 | */ |
134 | 134 | ||
135 | struct cpufreq_available_frequencies | 135 | struct cpufreq_frequencies |
136 | *cpufreq_get_available_frequencies(unsigned int cpu); | 136 | *cpufreq_get_frequencies(const char *type, unsigned int cpu); |
137 | 137 | ||
138 | void cpufreq_put_available_frequencies( | 138 | void cpufreq_put_frequencies( |
139 | struct cpufreq_available_frequencies *first); | 139 | struct cpufreq_frequencies *first); |
140 | 140 | ||
141 | 141 | ||
142 | /* determine affected CPUs | 142 | /* determine affected CPUs |
diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c index c3f39d5128ee..10290b308797 100644 --- a/tools/power/cpupower/utils/cpufreq-info.c +++ b/tools/power/cpupower/utils/cpufreq-info.c | |||
@@ -161,19 +161,12 @@ static void print_duration(unsigned long duration) | |||
161 | return; | 161 | return; |
162 | } | 162 | } |
163 | 163 | ||
164 | /* --boost / -b */ | 164 | static int get_boost_mode_x86(unsigned int cpu) |
165 | |||
166 | static int get_boost_mode(unsigned int cpu) | ||
167 | { | 165 | { |
168 | int support, active, b_states = 0, ret, pstate_no, i; | 166 | int support, active, b_states = 0, ret, pstate_no, i; |
169 | /* ToDo: Make this more global */ | 167 | /* ToDo: Make this more global */ |
170 | unsigned long pstates[MAX_HW_PSTATES] = {0,}; | 168 | unsigned long pstates[MAX_HW_PSTATES] = {0,}; |
171 | 169 | ||
172 | if (cpupower_cpu_info.vendor != X86_VENDOR_AMD && | ||
173 | cpupower_cpu_info.vendor != X86_VENDOR_HYGON && | ||
174 | cpupower_cpu_info.vendor != X86_VENDOR_INTEL) | ||
175 | return 0; | ||
176 | |||
177 | ret = cpufreq_has_boost_support(cpu, &support, &active, &b_states); | 170 | ret = cpufreq_has_boost_support(cpu, &support, &active, &b_states); |
178 | if (ret) { | 171 | if (ret) { |
179 | printf(_("Error while evaluating Boost Capabilities" | 172 | printf(_("Error while evaluating Boost Capabilities" |
@@ -248,6 +241,33 @@ static int get_boost_mode(unsigned int cpu) | |||
248 | return 0; | 241 | return 0; |
249 | } | 242 | } |
250 | 243 | ||
244 | /* --boost / -b */ | ||
245 | |||
246 | static int get_boost_mode(unsigned int cpu) | ||
247 | { | ||
248 | struct cpufreq_frequencies *freqs; | ||
249 | |||
250 | if (cpupower_cpu_info.vendor == X86_VENDOR_AMD || | ||
251 | cpupower_cpu_info.vendor == X86_VENDOR_HYGON || | ||
252 | cpupower_cpu_info.vendor == X86_VENDOR_INTEL) | ||
253 | return get_boost_mode_x86(cpu); | ||
254 | |||
255 | freqs = cpufreq_get_frequencies("boost", cpu); | ||
256 | if (freqs) { | ||
257 | printf(_(" boost frequency steps: ")); | ||
258 | while (freqs->next) { | ||
259 | print_speed(freqs->frequency); | ||
260 | printf(", "); | ||
261 | freqs = freqs->next; | ||
262 | } | ||
263 | print_speed(freqs->frequency); | ||
264 | printf("\n"); | ||
265 | cpufreq_put_frequencies(freqs); | ||
266 | } | ||
267 | |||
268 | return 0; | ||
269 | } | ||
270 | |||
251 | /* --freq / -f */ | 271 | /* --freq / -f */ |
252 | 272 | ||
253 | static int get_freq_kernel(unsigned int cpu, unsigned int human) | 273 | static int get_freq_kernel(unsigned int cpu, unsigned int human) |
@@ -456,7 +476,7 @@ static int get_latency(unsigned int cpu, unsigned int human) | |||
456 | 476 | ||
457 | static void debug_output_one(unsigned int cpu) | 477 | static void debug_output_one(unsigned int cpu) |
458 | { | 478 | { |
459 | struct cpufreq_available_frequencies *freqs; | 479 | struct cpufreq_frequencies *freqs; |
460 | 480 | ||
461 | get_driver(cpu); | 481 | get_driver(cpu); |
462 | get_related_cpus(cpu); | 482 | get_related_cpus(cpu); |
@@ -464,7 +484,7 @@ static void debug_output_one(unsigned int cpu) | |||
464 | get_latency(cpu, 1); | 484 | get_latency(cpu, 1); |
465 | get_hardware_limits(cpu, 1); | 485 | get_hardware_limits(cpu, 1); |
466 | 486 | ||
467 | freqs = cpufreq_get_available_frequencies(cpu); | 487 | freqs = cpufreq_get_frequencies("available", cpu); |
468 | if (freqs) { | 488 | if (freqs) { |
469 | printf(_(" available frequency steps: ")); | 489 | printf(_(" available frequency steps: ")); |
470 | while (freqs->next) { | 490 | while (freqs->next) { |
@@ -474,7 +494,7 @@ static void debug_output_one(unsigned int cpu) | |||
474 | } | 494 | } |
475 | print_speed(freqs->frequency); | 495 | print_speed(freqs->frequency); |
476 | printf("\n"); | 496 | printf("\n"); |
477 | cpufreq_put_available_frequencies(freqs); | 497 | cpufreq_put_frequencies(freqs); |
478 | } | 498 | } |
479 | 499 | ||
480 | get_available_governors(cpu); | 500 | get_available_governors(cpu); |