Skip to content

Commit 5066654

Browse files
committed
Merge tag 'linux-cpupower-6.13-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/shuah/linux
Merge a cpupower utility update for 6.13-rc1 from Shuah Khan: "This cpupower update for Linux 6.13-rc1 consists of changes to: -- bindings: - add generated files to gitignore - improve disable c_state block - new test to confirm cpu state is disabled -- bench: - print config file path when open cpufreq-bench.conf fails -- Makefile - override cross-compiling env params to make it easier for builds in Yocto environment. -- add documentation for new EPP value change, amd_pstate mode change, and turbo-boost features." * tag 'linux-cpupower-6.13-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/shuah/linux: pm: cpupower: bindings: Add test to confirm cpu state is disabled pm: cpupower: bindings: Improve disable c_state block pm: cpupower: gitignore: Add compile_commands.json pm: cpupower: Makefile: Allow overriding cross-compiling env params pm: cpupower: bench: print config file path when open cpufreq-bench.conf fails tools/power/cpupower: Add documentation for some recently introduced options
2 parents 8c763ff + b6a2dbf commit 5066654

File tree

5 files changed

+70
-16
lines changed

5 files changed

+70
-16
lines changed

tools/power/cpupower/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ debug/i386/intel_gsic
2727
debug/i386/powernow-k8-decode
2828
debug/x86_64/centrino-decode
2929
debug/x86_64/powernow-k8-decode
30+
31+
# Clang's compilation database file
32+
compile_commands.json

tools/power/cpupower/Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ INSTALL_SCRIPT = ${INSTALL} -m 644
8686
# If you are running a cross compiler, you may want to set this
8787
# to something more interesting, like "arm-linux-". If you want
8888
# to compile vs uClibc, that can be done here as well.
89-
CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
90-
CC = $(CROSS)gcc
91-
LD = $(CROSS)gcc
92-
AR = $(CROSS)ar
93-
STRIP = $(CROSS)strip
94-
RANLIB = $(CROSS)ranlib
89+
CROSS ?= #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
90+
CC ?= $(CROSS)gcc
91+
LD ?= $(CROSS)gcc
92+
AR ?= $(CROSS)ar
93+
STRIP ?= $(CROSS)strip
94+
RANLIB ?= $(CROSS)ranlib
9595
HOSTCC = gcc
9696
MKDIR = mkdir
9797

tools/power/cpupower/bench/parse.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Copyright (C) 2008 Christian Kornacker <ckornacker@suse.de>
55
*/
66

7+
#include <errno.h>
78
#include <stdio.h>
89
#include <stdlib.h>
910
#include <stdarg.h>
@@ -165,8 +166,8 @@ int prepare_config(const char *path, struct config *config)
165166

166167
configfile = fopen(path, "r");
167168
if (configfile == NULL) {
168-
perror("fopen");
169-
fprintf(stderr, "error: unable to read configfile\n");
169+
fprintf(stderr, "error: unable to read configfile: %s, %s\n",
170+
path, strerror(errno));
170171
free(config);
171172
return 1;
172173
}

tools/power/cpupower/bindings/python/test_raw_pylibcpupower.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,38 @@
1515
print(f"cstate count error: return code: {cpu_cstates_count}")
1616

1717
"""
18-
Disable cstate (will fail if the above is 0, ex: a virtual machine)
18+
Disable cstate (will fail if the above returns is under 1, ex: a virtual machine)
1919
"""
2020
cstate_disabled = p.cpuidle_state_disable(0, 0, 1)
21-
if cpu_cstates_count == 0:
22-
print(f"CPU 0 has {cpu_cstates_count} c-states")
23-
else:
24-
print(f"cstate count error: return code: {cpu_cstates_count}")
2521

2622
match cstate_disabled:
2723
case 0:
2824
print(f"CPU state disabled")
2925
case -1:
3026
print(f"Idlestate not available")
27+
case -2:
28+
print(f"Disabling is not supported by the kernel")
29+
case -3:
30+
print(f"No write access to disable/enable C-states: try using sudo")
3131
case _:
32-
print(f"Not documented")
32+
print(f"Not documented: {cstate_disabled}")
33+
34+
"""
35+
Test cstate is disabled
36+
"""
37+
is_cstate_disabled = p.cpuidle_is_state_disabled(0, 0)
3338

39+
match is_cstate_disabled:
40+
case 1:
41+
print(f"CPU is disabled")
42+
case 0:
43+
print(f"CPU is enabled")
44+
case -1:
45+
print(f"Idlestate not available")
46+
case -2:
47+
print(f"Disabling is not supported by kernel")
48+
case _:
49+
print(f"Not documented: {is_cstate_disabled}")
3450

3551
# Pointer example
3652

tools/power/cpupower/man/cpupower-set.1

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
cpupower\-set \- Set processor power related kernel or hardware configurations
44
.SH SYNOPSIS
55
.ft B
6-
.B cpupower set [ \-b VAL ]
6+
.B cpupower set [ \-b VAL | \-e POLICY | \-m MODE | \-t BOOL ]
77

88

99
.SH DESCRIPTION
@@ -19,7 +19,7 @@ described in the Options sections.
1919
Use \fBcpupower info \fP to read out current settings and whether they are
2020
supported on the system at all.
2121

22-
.SH Options
22+
.SH OPTIONS
2323
.PP
2424
\-\-perf-bias, \-b
2525
.RS 4
@@ -56,6 +56,40 @@ Use \fBcpupower -c all info -b\fP to verify.
5656
This options needs the msr kernel driver (CONFIG_X86_MSR) loaded.
5757
.RE
5858

59+
.PP
60+
\-\-epp, \-e
61+
.RS 4
62+
Sets the energy performance policy preference on supported Intel or AMD
63+
processors which use the Intel or AMD P-State cpufreq driver respectively.
64+
65+
Available policies can be found with
66+
\fBcat /sys/devices/system/cpu/cpufreq/policy0/energy_performance_available_preferences\fP :
67+
.RS 4
68+
default performance balance_performance balance_power power
69+
.RE
70+
71+
.RE
72+
73+
.PP
74+
\-\-amd\-pstate\-mode, \-m
75+
.RS 4
76+
Sets the AMD P-State mode for supported AMD processors.
77+
Available modes are "active", "guided" or "passive".
78+
79+
Refer to the AMD P-State kernel documentation for further information.
80+
81+
.RE
82+
83+
.PP
84+
\-\-turbo\-boost, \-t
85+
.RS 4
86+
This option is used to enable or disable the turbo boost feature on
87+
supported Intel and AMD processors.
88+
89+
This option takes as parameter either \fB1\fP to enable, or \fB0\fP to disable the feature.
90+
91+
.RE
92+
5993
.SH "SEE ALSO"
6094
cpupower-info(1), cpupower-monitor(1), powertop(1)
6195
.PP

0 commit comments

Comments
 (0)