Thread (59 messages) 59 messages, 6 authors, 2021-09-17
STALE1730d
Revisions (5)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]
  5. v5 [diff vs current]

[PATCH 18/19] cpupower: print amd-pstate information on cpupower

From: Huang Rui <ray.huang@amd.com>
Date: 2021-09-08 15:02:29
Also in: lkml
Subsystem: cpu power monitoring subsystem, the rest · Maintainers: Thomas Renninger, Shuah Khan, John B. Wyatt IV, John Kacur, Linus Torvalds

amd-pstate kernel module is using the fine grain frequency instead of
acpi hardware pstate. So the performance and frequency values should be
printed in frequency-info.

Signed-off-by: Huang Rui <ray.huang@amd.com>
---
 tools/power/cpupower/utils/cpufreq-info.c | 27 ++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c
index f9895e31ff5a..9eabed209adc 100644
--- a/tools/power/cpupower/utils/cpufreq-info.c
+++ b/tools/power/cpupower/utils/cpufreq-info.c
@@ -183,9 +183,30 @@ static int get_boost_mode_x86(unsigned int cpu)
 	printf(_("    Supported: %s\n"), support ? _("yes") : _("no"));
 	printf(_("    Active: %s\n"), active ? _("yes") : _("no"));
 
-	if ((cpupower_cpu_info.vendor == X86_VENDOR_AMD &&
-	     cpupower_cpu_info.family >= 0x10) ||
-	     cpupower_cpu_info.vendor == X86_VENDOR_HYGON) {
+	if (cpupower_cpu_info.vendor == X86_VENDOR_AMD &&
+	    cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATE) {
+		printf(_("    AMD PSTATE Highest Performance: %u. Maximum Frequency: "),
+		       amd_pstate_get_data(cpu, HIGHEST_PERF));
+		print_speed(amd_pstate_get_data(cpu, MAX_FREQ));
+		printf(".\n");
+
+		printf(_("    AMD PSTATE Nominal Performance: %u. Nominal Frequency: "),
+		       amd_pstate_get_data(cpu, NOMINAL_PERF));
+		print_speed(amd_pstate_get_data(cpu, NOMINAL_FREQ));
+		printf(".\n");
+
+		printf(_("    AMD PSTATE Lowest Non-linear Performance: %u. Lowest Non-linear Frequency: "),
+		       amd_pstate_get_data(cpu, LOWEST_NONLINEAR_PERF));
+		print_speed(amd_pstate_get_data(cpu, LOWEST_NONLINEAR_FREQ));
+		printf(".\n");
+
+		printf(_("    AMD PSTATE Lowest Performance: %u. Lowest Frequency: "),
+		       amd_pstate_get_data(cpu, LOWEST_PERF));
+		print_speed(amd_pstate_get_data(cpu, MIN_FREQ));
+		printf(".\n");
+	} else if ((cpupower_cpu_info.vendor == X86_VENDOR_AMD &&
+		    cpupower_cpu_info.family >= 0x10) ||
+		   cpupower_cpu_info.vendor == X86_VENDOR_HYGON) {
 		ret = decode_pstates(cpu, b_states, pstates, &pstate_no);
 		if (ret)
 			return ret;
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help