Skip to contentSkip to conversation

tools/xenpm: Print CPPC parameters for amd-pstate driver

PATCH Superseded Penny Zheng 2 participants 2 messages Dec 3, 2024 – Jan 9, 2025

v1 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

PATCH 10/11 tools/xenpm: Print CPPC parameters for amd-pstate driver

From: Penny Zheng <[email protected]>

HWP, amd-pstate, amd-pstate-epp are all the implementation of ACPI CPPC (Collaborative Processor Performace Control), so we introduce cppc_mode flag to print CPPC-related para.

And HWP and amd-pstate-epp are both governor-less driver, so we introduce hw_auto flag to bypass governor-related print.

---
 tools/misc/xenpm.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
tools/misc/xenpm.c +15 -4
index 336d246346..a09b53c4f3 100644
@@ -787,12 +787,22 @@ static unsigned int calculate_activity_window(const xc_cppc_para_t *cppc,
     return mantissa * multiplier;
 }
 
+
 /* print out parameters about cpu frequency */
 static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
 {
-    bool hwp = strcmp(p_cpufreq->scaling_driver, XEN_HWP_DRIVER_NAME) == 0;
+    bool cppc_mode = false, hw_auto = false;
     int i;
 
+    if ( !strcmp(p_cpufreq->scaling_driver, XEN_HWP_DRIVER_NAME) ||
+         !strcmp(p_cpufreq->scaling_driver, XEN_AMD_PSTATE_DRIVER_NAME) ||
+         !strcmp(p_cpufreq->scaling_driver, XEN_AMD_PSTATE_EPP_DRIVER_NAME) )
+        cppc_mode = true;
+
+    if ( !strcmp(p_cpufreq->scaling_driver, XEN_HWP_DRIVER_NAME) ||
+         !strcmp(p_cpufreq->scaling_driver, XEN_AMD_PSTATE_EPP_DRIVER_NAME) )
+        hw_auto = true;
+
     printf("cpu id               : %d\n", cpuid);
 
     printf("affected_cpus        :");
@@ -800,7 +810,7 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
         printf(" %d", p_cpufreq->affected_cpus[i]);
     printf("\n");
 
-    if ( hwp )
+    if ( hw_auto )
         printf("cpuinfo frequency    : base [%"PRIu32"] max [%"PRIu32"]\n",
                p_cpufreq->cpuinfo_min_freq,
                p_cpufreq->cpuinfo_max_freq);
@@ -812,7 +822,7 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
 
     printf("scaling_driver       : %s\n", p_cpufreq->scaling_driver);
 
-    if ( hwp )
+    if ( cppc_mode )
     {
         const xc_cppc_para_t *cppc = &p_cpufreq->u.cppc_para;
 
@@ -838,7 +848,8 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
                cppc->desired,
                cppc->desired ? "" : " hw autonomous");
     }
-    else
+
+    if ( !hw_auto )
     {
         printf("scaling_avail_gov    : %s\n",
                p_cpufreq->scaling_available_governors);
Signature · 1 line
2.34.1
Acked-by on v1 10/11
#1 lore raw

tools/misc/xenpm.c static unsigned int calculate_activity_window(const xc_cppc_para_t *cppc, · line 791

Quoted 8 lines · Penny Zheng
tools/misc/xenpm.c +1 -0
@@ -787,12 +787,22 @@ static unsigned int calculate_activity_window(const xc_cppc_para_t *cppc,
     return mantissa * multiplier;
 }
 
+
 /* print out parameters about cpu frequency */

No double blank lines please. With this taken care of:

Jan