From: Shuah Khan <skhan@linuxfoundation.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Shuah Khan <skhan@linuxfoundation.org>, shuah <shuah@kernel.org>,
"John B. Wyatt IV" <jwyatt@redhat.com>,
John Kacur <jkacur@redhat.com>, Thomas Renninger <trenn@suse.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux PM <linux-pm@vger.kernel.org>
Subject: [GIT PULL] cpupower fixes update for Linux 7.3-rc1
Date: Tue, 4 Aug 2026 15:31:49 -0600 [thread overview]
Message-ID: <962d2e30-9270-4652-b802-1676966b7968@linuxfoundation.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 2003 bytes --]
Hi Rafael,
Please pull the cpupower update for Linux 7.3-rc1.
Adds support for generic CPPC display that depends only on standardized
fields, improving AMD specific implementation for the same.
Removes conditional return with no effect as part of tree-wide code clean
up effort.
diff is attached.
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit dc59e4fea9d83f03bad6bddf3fa2e52491777482:
Linux 7.2-rc1 (2026-06-28 12:01:31 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux tags/linux-cpupower-7.3-rc1
for you to fetch changes up to adfe0057326ffbc2cd5ff69a57ec0e50b5e74095:
cpupower: remove conditional return with no effect (2026-08-04 13:12:06 -0600)
----------------------------------------------------------------
linux-cpupower-7.3-rc1
Adds support for generic CPPC display that depends only on standardized
fields, improving AMD specific implementation for the same.
Removes conditional return with no effect as part of tree-wide code clean
up effort.
----------------------------------------------------------------
Jeremy Linton (4):
cpupower: Add generic CPPC performance display
cpupower: Build and call CPPC information on non-AMD processors
cpupower: Print kernel and hardware frequency information
cpupower: Add libm to cpupower for generic CPPC view
Sang-Heon Jeon (1):
cpupower: remove conditional return with no effect
tools/power/cpupower/Makefile | 6 +--
tools/power/cpupower/utils/cpufreq-info.c | 11 +++---
tools/power/cpupower/utils/helpers/cppc.c | 56 ++++++++++++++++++++++++++++
tools/power/cpupower/utils/helpers/helpers.h | 2 +
tools/power/cpupower/utils/powercap-info.c | 2 -
5 files changed, 67 insertions(+), 10 deletions(-)
create mode 100644 tools/power/cpupower/utils/helpers/cppc.c
----------------------------------------------------------------
[-- Attachment #2: linux-cpupower-7.3-rc1.diff --]
[-- Type: text/x-patch, Size: 5553 bytes --]
diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile
index 969716dfe8de..ab428e336d87 100644
--- a/tools/power/cpupower/Makefile
+++ b/tools/power/cpupower/Makefile
@@ -131,7 +131,7 @@ override CFLAGS += -DVERSION=\"$(VERSION)\" -DPACKAGE=\"$(PACKAGE)\" \
UTIL_OBJS = utils/helpers/amd.o utils/helpers/msr.o \
utils/helpers/sysfs.o utils/helpers/misc.o utils/helpers/cpuid.o \
- utils/helpers/pci.o utils/helpers/bitmask.o \
+ utils/helpers/pci.o utils/helpers/bitmask.o utils/helpers/cppc.o \
utils/idle_monitor/nhm_idle.o utils/idle_monitor/snb_idle.o \
utils/idle_monitor/hsw_ext_idle.o \
utils/idle_monitor/amd_fam14h_idle.o utils/idle_monitor/cpuidle_sysfs.o \
@@ -236,9 +236,9 @@ $(OUTPUT)%.o: %.c
$(OUTPUT)cpupower: $(UTIL_OBJS) $(OUTPUT)$(LIBCPUPOWER)
$(ECHO) " CC " $@
ifeq ($(strip $(STATIC)),true)
- $(QUIET) $(CC) $(CFLAGS) $(LDFLAGS) $(UTIL_OBJS) -lrt -lpci -L$(OUTPUT) -o $@
+ $(QUIET) $(CC) $(CFLAGS) $(LDFLAGS) $(UTIL_OBJS) -lm -lrt -lpci -L$(OUTPUT) -o $@
else
- $(QUIET) $(CC) $(CFLAGS) $(LDFLAGS) $(UTIL_OBJS) -lcpupower -lrt -lpci -L$(OUTPUT) -o $@
+ $(QUIET) $(CC) $(CFLAGS) $(LDFLAGS) $(UTIL_OBJS) -lm -lcpupower -lrt -lpci -L$(OUTPUT) -o $@
endif
$(QUIET) $(STRIPCMD) $@
diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c
index 5a242b491a9d..11629ae49f98 100644
--- a/tools/power/cpupower/utils/cpufreq-info.c
+++ b/tools/power/cpupower/utils/cpufreq-info.c
@@ -270,10 +270,10 @@ static int get_freq_hardware(unsigned int cpu, unsigned int human)
{
unsigned long freq;
- if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_APERF))
+ freq = cpufreq_get_freq_hardware(cpu);
+ if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_APERF) && !freq)
return -EINVAL;
- freq = cpufreq_get_freq_hardware(cpu);
printf(_(" current CPU frequency: "));
if (!freq) {
printf("Unable to call hardware\n");
@@ -477,12 +477,13 @@ static int get_latency(unsigned int cpu, unsigned int human)
}
/* --performance / -c */
-
static int get_perf_cap(unsigned int cpu)
{
if (cpupower_cpu_info.vendor == X86_VENDOR_AMD &&
cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATE)
amd_pstate_show_perf_and_freq(cpu, no_rounding);
+ else
+ cppc_show_perf_and_freq(cpu, no_rounding);
return 0;
}
@@ -513,8 +514,8 @@ static void debug_output_one(unsigned int cpu)
get_available_governors(cpu);
get_policy(cpu);
- if (get_freq_hardware(cpu, 1) < 0)
- get_freq_kernel(cpu, 1);
+ get_freq_hardware(cpu, 1);
+ get_freq_kernel(cpu, 1);
get_boost_mode(cpu);
get_perf_cap(cpu);
}
diff --git a/tools/power/cpupower/utils/helpers/cppc.c b/tools/power/cpupower/utils/helpers/cppc.c
new file mode 100644
index 000000000000..3493ce8551ea
--- /dev/null
+++ b/tools/power/cpupower/utils/helpers/cppc.c
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "helpers/helpers.h"
+#include "cpufreq.h"
+#include "acpi_cppc.h"
+
+#define cppc_to_frequency(perf) (roundf(slope * (perf) + intercept))
+
+void cppc_show_perf_and_freq(unsigned int cpu, int no_rounding)
+{
+ int64_t nominal = acpi_cppc_get_data(cpu, NOMINAL_PERF);
+ int64_t nominal_freq = acpi_cppc_get_data(cpu, NOMINAL_FREQ) * 1000;
+ int64_t lowest = acpi_cppc_get_data(cpu, LOWEST_PERF);
+ int64_t lowest_freq = acpi_cppc_get_data(cpu, LOWEST_FREQ) * 1000;
+ unsigned long non_linear = acpi_cppc_get_data(cpu, LOWEST_NONLINEAR_PERF);
+ unsigned long highest = acpi_cppc_get_data(cpu, HIGHEST_PERF);
+ float slope, intercept;
+
+ /* do the optional freq fields look invalid? */
+ if (!nominal_freq || !lowest_freq || nominal == lowest)
+ return;
+
+ slope = (float)(nominal_freq - lowest_freq) / (nominal - lowest);
+ intercept = lowest_freq - slope * lowest;
+
+ printf(_(" CPPC limits:\n"));
+ printf(_(" Highest Performance: %lu. Maximum Frequency: "),
+ highest);
+ /*
+ * If boost isn't active, the cpuinfo_max doesn't indicate real max
+ * frequency.
+ */
+ print_speed(cppc_to_frequency(highest), no_rounding);
+ printf(".\n");
+
+ printf(_(" Nominal Performance: %lu. Nominal Frequency: "),
+ acpi_cppc_get_data(cpu, NOMINAL_PERF));
+ print_speed(nominal_freq, no_rounding);
+ printf(".\n");
+
+ printf(_(" Lowest Non-linear Performance: %lu. Lowest Non-linear Frequency: "),
+ non_linear);
+ print_speed(cppc_to_frequency(non_linear), no_rounding);
+ printf(".\n");
+
+ printf(_(" Lowest Performance: %lu. Lowest Frequency: "),
+ acpi_cppc_get_data(cpu, LOWEST_PERF));
+ print_speed(lowest_freq, no_rounding);
+ printf(".\n");
+}
diff --git a/tools/power/cpupower/utils/helpers/helpers.h b/tools/power/cpupower/utils/helpers/helpers.h
index a3ad80b9c2c2..9c5126b63966 100644
--- a/tools/power/cpupower/utils/helpers/helpers.h
+++ b/tools/power/cpupower/utils/helpers/helpers.h
@@ -221,4 +221,6 @@ void print_online_cpus(void);
void print_offline_cpus(void);
void print_speed(unsigned long speed, int no_rounding);
+void cppc_show_perf_and_freq(unsigned int cpu, int no_rounding);
+
#endif /* __CPUPOWERUTILS_HELPERS__ */
diff --git a/tools/power/cpupower/utils/powercap-info.c b/tools/power/cpupower/utils/powercap-info.c
index e53033488218..88a5edb76315 100644
--- a/tools/power/cpupower/utils/powercap-info.c
+++ b/tools/power/cpupower/utils/powercap-info.c
@@ -47,8 +47,6 @@ static int powercap_print_one_zone(struct powercap_zone *zone)
printf("\n");
- if (ret != 0)
- return ret;
return ret;
}
next reply other threads:[~2026-08-04 21:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 21:31 Shuah Khan [this message]
2026-08-05 11:56 ` [GIT PULL] cpupower fixes update for Linux 7.3-rc1 Rafael J. Wysocki (Intel)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=962d2e30-9270-4652-b802-1676966b7968@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=jkacur@redhat.com \
--cc=jwyatt@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=shuah@kernel.org \
--cc=trenn@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox