linux-cpupower-6.13-rc1

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.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEPZKym/RZuOCGeA/kCwJExA0NQxwFAmcJpvYACgkQCwJExA0N
 QxygfBAAm8RiF99bLm2pPlxv0rG/wXSJr/kRSTMYOYNBmhzg47KMZvPON9ZR7uqG
 b7F7aQSyYKeWfOOgj//lvHghBNlDVxaL6qJY/8RdZLgDM8QfuNBdy1dddPFze1vI
 +MGBbXNU4UCxg8jJW4yNvKsJekd67yxFQLlsPAx00uuwiafbBBcvlXOj43ClC7mq
 eJrmtib3zAcM0PeixU+wTmLS7l4tAwU1U1rYKpcR0ja3bZnuU3qKNQE7N8BR1IkR
 STCBizQcfE7lAV4uc65z3ggc5apyqOC8P0ZaMEK0mmvJJWxrAxh3P0TsWrrthfXg
 1trsvXKswvXnJCBVKYNfVy2qwNrf99UycV6savMfndGJrbvZtTPXgeTCDNEYoaS7
 utmSLQshgW+y5IfLjh32izT750TaDgvC6iH/W8G13QC/ufrfgTDilyU479QrjImP
 noT7w65Ipljd71bBOb6MCDZV8oc2Dkdl2wQ+98ic2NIa2slYXpQknzdire3ud3zj
 gNrm4VXl/3GeIoKVzk/4lhzFG7/bnkYSFmX1OjFrFGUrC9BD5Ps9dnnBtnCS5zgD
 JQF7osKKOP1h2dOWNAzLV49VELL5ppbG5Ij0Gj2G+r0htdHWfnjNF+Y+4zQAUQYq
 3MCfmJjJ/Z5kroIwFHKfH7ypaPr9lIZcyBWYMYxdZmtQ7uHamOA=
 =aW91
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Rafael J. Wysocki 2024-10-15 21:23:28 +02:00
commit 5066654db2
5 changed files with 70 additions and 16 deletions

View File

@ -27,3 +27,6 @@ debug/i386/intel_gsic
debug/i386/powernow-k8-decode
debug/x86_64/centrino-decode
debug/x86_64/powernow-k8-decode
# Clang's compilation database file
compile_commands.json

View File

@ -86,12 +86,12 @@ INSTALL_SCRIPT = ${INSTALL} -m 644
# If you are running a cross compiler, you may want to set this
# to something more interesting, like "arm-linux-". If you want
# to compile vs uClibc, that can be done here as well.
CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
CC = $(CROSS)gcc
LD = $(CROSS)gcc
AR = $(CROSS)ar
STRIP = $(CROSS)strip
RANLIB = $(CROSS)ranlib
CROSS ?= #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
CC ?= $(CROSS)gcc
LD ?= $(CROSS)gcc
AR ?= $(CROSS)ar
STRIP ?= $(CROSS)strip
RANLIB ?= $(CROSS)ranlib
HOSTCC = gcc
MKDIR = mkdir

View File

@ -4,6 +4,7 @@
* Copyright (C) 2008 Christian Kornacker <ckornacker@suse.de>
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@ -165,8 +166,8 @@ int prepare_config(const char *path, struct config *config)
configfile = fopen(path, "r");
if (configfile == NULL) {
perror("fopen");
fprintf(stderr, "error: unable to read configfile\n");
fprintf(stderr, "error: unable to read configfile: %s, %s\n",
path, strerror(errno));
free(config);
return 1;
}

View File

@ -15,22 +15,38 @@ else:
print(f"cstate count error: return code: {cpu_cstates_count}")
"""
Disable cstate (will fail if the above is 0, ex: a virtual machine)
Disable cstate (will fail if the above returns is under 1, ex: a virtual machine)
"""
cstate_disabled = p.cpuidle_state_disable(0, 0, 1)
if cpu_cstates_count == 0:
print(f"CPU 0 has {cpu_cstates_count} c-states")
else:
print(f"cstate count error: return code: {cpu_cstates_count}")
match cstate_disabled:
case 0:
print(f"CPU state disabled")
case -1:
print(f"Idlestate not available")
case -2:
print(f"Disabling is not supported by the kernel")
case -3:
print(f"No write access to disable/enable C-states: try using sudo")
case _:
print(f"Not documented")
print(f"Not documented: {cstate_disabled}")
"""
Test cstate is disabled
"""
is_cstate_disabled = p.cpuidle_is_state_disabled(0, 0)
match is_cstate_disabled:
case 1:
print(f"CPU is disabled")
case 0:
print(f"CPU is enabled")
case -1:
print(f"Idlestate not available")
case -2:
print(f"Disabling is not supported by kernel")
case _:
print(f"Not documented: {is_cstate_disabled}")
# Pointer example

View File

@ -3,7 +3,7 @@
cpupower\-set \- Set processor power related kernel or hardware configurations
.SH SYNOPSIS
.ft B
.B cpupower set [ \-b VAL ]
.B cpupower set [ \-b VAL | \-e POLICY | \-m MODE | \-t BOOL ]
.SH DESCRIPTION
@ -19,7 +19,7 @@ described in the Options sections.
Use \fBcpupower info \fP to read out current settings and whether they are
supported on the system at all.
.SH Options
.SH OPTIONS
.PP
\-\-perf-bias, \-b
.RS 4
@ -56,6 +56,40 @@ Use \fBcpupower -c all info -b\fP to verify.
This options needs the msr kernel driver (CONFIG_X86_MSR) loaded.
.RE
.PP
\-\-epp, \-e
.RS 4
Sets the energy performance policy preference on supported Intel or AMD
processors which use the Intel or AMD P-State cpufreq driver respectively.
Available policies can be found with
\fBcat /sys/devices/system/cpu/cpufreq/policy0/energy_performance_available_preferences\fP :
.RS 4
default performance balance_performance balance_power power
.RE
.RE
.PP
\-\-amd\-pstate\-mode, \-m
.RS 4
Sets the AMD P-State mode for supported AMD processors.
Available modes are "active", "guided" or "passive".
Refer to the AMD P-State kernel documentation for further information.
.RE
.PP
\-\-turbo\-boost, \-t
.RS 4
This option is used to enable or disable the turbo boost feature on
supported Intel and AMD processors.
This option takes as parameter either \fB1\fP to enable, or \fB0\fP to disable the feature.
.RE
.SH "SEE ALSO"
cpupower-info(1), cpupower-monitor(1), powertop(1)
.PP