Skip to contentSkip to conversation

xen/cpufreq: Adapt SET/GET_CPUFREQ_CPPC xen_sysctl_pm_op for amd-cppc driver

PATCH Superseded Penny Zheng 3 participants 8 messages Aug 28, 2025 – Sep 4, 2025

v8 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

PATCH v8 8/8 xen/cpufreq: Adapt SET/GET_CPUFREQ_CPPC xen_sysctl_pm_op for amd-cppc driver

Introduce helper set_amd_cppc_para() and get_amd_cppc_para() to SET/GET CPPC-related para for amd-cppc/amd-cppc-epp driver.

In get_cpufreq_cppc()/set_cpufreq_cppc(), we include "processor_pminfo[cpuid]->init & XEN_CPPC_INIT" condition check to deal with cpufreq driver in amd-cppc.
We also borrow governor field to indicate policy info for CPPC active mode.

---
v1 -> v2:
- Give the variable des_perf an initializer of 0
- Use the strncmp()s directly in the if()
---
v3 -> v4
- refactor comments
- remove double blank lines
- replace amd_cppc_in_use flag with XEN_PROCESSOR_PM_CPPC
---
v4 -> v5:
- add new field "policy" in "struct xen_cppc_para"
- add new performamce policy XEN_CPUFREQ_POLICY_BALANCE
- drop string comparisons with "processor_pminfo[cpuid]->init & XEN_CPPC_INIT" and "cpufreq.setpolicy == NULL"
- Blank line ahead of the main "return" of a function
- refactor comments, commit message and title
---
v5 -> v6:
- remove duplicated manifest constants, and just move it to public header
- use "else if" to avoid confusion that it looks as if both paths could be taken
- add check for legitimate perf values
- use "unknown" instead of "none"
- introduce "CPUFREQ_POLICY_END" for array overrun check in user space tools
---
v6 -> v7:
- use ARRAY_SIZE() instead
- ->policy print is avoided in passive mode and print "unknown" in invalid cases
- let cpufreq_is_governorless() being the variable's initializer
- refactor with the conditional operator to increase readability
- move duplicated defination ahead and use local variable
- avoid using "else-condition" to bring "dead code" in Misra's nomeclature
- move the comment out of public header and into the respective internal struct field
- wrap set{,get}_amd_cppc_para() with CONFIG_PM_OP
- add symmetry scenario for maximum check
---
v7 -> v8:
- change function name to amd_cppc_get{,set}_para()
- fix too deep indentation, and indent according to pending open parentheses
- missing -EINVAL when no flag is set at all
- use new helper amd_cppc_prepare_policy() to reduce redundancy
- borrow governor field to indicate policy info

---
 tools/misc/xenpm.c                   |  13 ++-
 xen/arch/x86/acpi/cpufreq/amd-cppc.c | 164 +++++++++++++++++++++++++++
 xen/drivers/acpi/pm-op.c             |  28 +++--
 xen/include/acpi/cpufreq/cpufreq.h   |   4 +
 4 files changed, 196 insertions(+), 13 deletions(-)
tools/misc/xenpm.c +10 -3
index 893a0afe11..bda9c62aa0 100644
@@ -832,11 +832,14 @@ static void print_cppc_para(unsigned int cpuid,
 /* print out parameters about cpu frequency */
 static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
 {
-    bool is_governor_less = false;
+    bool is_governor_less = false, is_cppc_active = false;
     int i;
 
-    if ( !strcmp(p_cpufreq->scaling_driver, XEN_HWP_DRIVER_NAME) ||
-         !strcmp(p_cpufreq->scaling_driver, XEN_AMD_CPPC_EPP_DRIVER_NAME) )
+    if ( !strcmp(p_cpufreq->scaling_driver, XEN_AMD_CPPC_EPP_DRIVER_NAME) )
+        is_cppc_active = true;
+
+    if ( is_cppc_active ||
+         !strcmp(p_cpufreq->scaling_driver, XEN_HWP_DRIVER_NAME) )
         is_governor_less = true;
 
     printf("cpu id               : %d\n", cpuid);
@@ -899,6 +902,10 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)
                p_cpufreq->u.s.scaling_cur_freq);
     }
 
+    /* Translate governor info to policy info in CPPC active mode */
+    if ( is_cppc_active )
+        printf("policy               : %s\n", p_cpufreq->u.s.scaling_governor);
+
     printf("turbo mode           : %s\n",
            p_cpufreq->turbo_enabled ? "enabled" : "disabled or n/a");
     printf("\n");
xen/arch/x86/acpi/cpufreq/amd-cppc.c +164 -0

170 lines not on this page · raw message

xen/drivers/acpi/pm-op.c +18 -10
index 371deaf678..bcb3b9b2a7 100644
@@ -84,6 +84,8 @@ static int get_cpufreq_cppc(unsigned int cpu,
 
     if ( hwp_active() )
         ret = get_hwp_para(cpu, cppc_para);
+    else if ( processor_pminfo[cpu]->init & XEN_CPPC_INIT )
+        ret = amd_cppc_get_para(per_cpu(cpufreq_cpu_policy, cpu), cppc_para);
 
     return ret;
 }
@@ -154,6 +156,17 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
     else
         strlcpy(op->u.get_para.scaling_driver, "Unknown", CPUFREQ_NAME_LEN);
 
+    /*
+     * In CPPC active mode, we are borrowing governor field to indicate
+     * policy info.
+     */
+    if ( policy->governor->name[0] )
+        strlcpy(op->u.get_para.u.s.scaling_governor,
+                policy->governor->name, CPUFREQ_NAME_LEN);
+    else
+        strlcpy(op->u.get_para.u.s.scaling_governor, "Unknown",
+                CPUFREQ_NAME_LEN);
+
     if ( !cpufreq_is_governorless(op->cpuid) )
     {
         if ( !(scaling_available_governors =
@@ -178,13 +191,6 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
         op->u.get_para.u.s.scaling_max_freq = policy->max;
         op->u.get_para.u.s.scaling_min_freq = policy->min;
 
-        if ( policy->governor->name[0] )
-            strlcpy(op->u.get_para.u.s.scaling_governor,
-                    policy->governor->name, CPUFREQ_NAME_LEN);
-        else
-            strlcpy(op->u.get_para.u.s.scaling_governor, "Unknown",
-                    CPUFREQ_NAME_LEN);
-
         /* governor specific para */
         if ( !strncasecmp(op->u.get_para.u.s.scaling_governor,
                           "userspace", CPUFREQ_NAME_LEN) )
@@ -321,10 +327,12 @@ static int set_cpufreq_cppc(struct xen_sysctl_pm_op *op)
     if ( !policy || !policy->governor )
         return -ENOENT;
 
-    if ( !hwp_active() )
-        return -EOPNOTSUPP;
+    if ( hwp_active() )
+        return set_hwp_para(policy, &op->u.set_cppc);
+    if ( processor_pminfo[op->cpuid]->init & XEN_CPPC_INIT )
+        return amd_cppc_set_para(policy, &op->u.set_cppc);
 
-    return set_hwp_para(policy, &op->u.set_cppc);
+    return -EOPNOTSUPP;
 }
 
 int do_pm_op(struct xen_sysctl_pm_op *op)
xen/include/acpi/cpufreq/cpufreq.h +4 -0
index 7caeae26cf..e8b4e955a2 100644
@@ -293,6 +293,10 @@ int acpi_cpufreq_register(void);
 
 int amd_cppc_cmdline_parse(const char *s, const char *e);
 int amd_cppc_register_driver(void);
+int amd_cppc_get_para(const struct cpufreq_policy *policy,
+                      struct xen_get_cppc_para *cppc_para);
+int amd_cppc_set_para(struct cpufreq_policy *policy,
+                      const struct xen_set_cppc_para *set_cppc);
 
 /*
  * Governor-less cpufreq driver indicates the driver doesn't rely on Xen
Signature · 1 line
2.34.1
#1 lore raw
Quoted 4 lines · Penny Zheng
xen/drivers/acpi/pm-op.c +0 -0
@@ -154,6 +156,17 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
     else
         strlcpy(op->u.get_para.scaling_driver, "Unknown", CPUFREQ_NAME_LEN);
 

xen/drivers/acpi/pm-op.c static int get_cpufreq_para(struct xen_sysctl_pm_op *op) · line 168

Quoted 10 lines
xen/drivers/acpi/pm-op.c +10 -0
+    /*
+     * In CPPC active mode, we are borrowing governor field to indicate
+     * policy info.
+     */
+    if ( policy->governor->name[0] )
+        strlcpy(op->u.get_para.u.s.scaling_governor,
+                policy->governor->name, CPUFREQ_NAME_LEN);
+    else
+        strlcpy(op->u.get_para.u.s.scaling_governor, "Unknown",
+                CPUFREQ_NAME_LEN);

Isn't pulling this ...

xen/drivers/acpi/pm-op.c static int get_cpufreq_para(struct xen_sysctl_pm_op *op) · line 172

Quoted 3 lines
xen/drivers/acpi/pm-op.c +0 -0
     if ( !cpufreq_is_governorless(op->cpuid) )
     {
         if ( !(scaling_available_governors =

... out of this if()'s body going to affect HWP? It's not clear to me whether that would be entirely benign.

Jan

#2 lore raw

[Public]

Quoted 28 lines

-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: Thursday, August 28, 2025 7:07 PM
To: Penny, Zheng <[email protected]>
Cc: Huang, Ray <[email protected]>; Anthony PERARD <[email protected]>; Andrew Cooper <[email protected]>; Roger Pau Monné <[email protected]>; [email protected]
Subject: Re: [PATCH v8 8/8] xen/cpufreq: Adapt SET/GET_CPUFREQ_CPPC xen_sysctl_pm_op for amd-cppc driver

Review static int get_cpufreq_para(struct xen_sysctl_pm_op

Quoted 1 line · Penny Zheng
(quoted diff) +0 -0
@@ -154,6 +156,17 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op

*op)

Quoted 4 lines
xen/drivers/acpi/pm-op.c +0 -0
     else
         strlcpy(op->u.get_para.scaling_driver, "Unknown",
 CPUFREQ_NAME_LEN);
 

xen/drivers/acpi/pm-op.c static int get_cpufreq_para(struct xen_sysctl_pm_op *op) · line 168

Quoted 10 lines
xen/drivers/acpi/pm-op.c +10 -0
+    /*
+     * In CPPC active mode, we are borrowing governor field to indicate
+     * policy info.
+     */
+    if ( policy->governor->name[0] )
+        strlcpy(op->u.get_para.u.s.scaling_governor,
+                policy->governor->name, CPUFREQ_NAME_LEN);
+    else
+        strlcpy(op->u.get_para.u.s.scaling_governor, "Unknown",
+                CPUFREQ_NAME_LEN);
Quoted 9 lines

Isn't pulling this ...

xen/drivers/acpi/pm-op.c static int get_cpufreq_para(struct xen_sysctl_pm_op *op) · line 172

Quoted 3 lines
xen/drivers/acpi/pm-op.c +0 -0
     if ( !cpufreq_is_governorless(op->cpuid) )
     {
         if ( !(scaling_available_governors =

... out of this if()'s body going to affect HWP? It's not clear to me whether that would be entirely benign.

HWP has its own unique "hwp" governor. So, imo, it may not affect.

Quoted 1 line

Jan

#3 lore raw
Quoted 32 lines · Zheng

[Public]

Quoted 30 lines

-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: Thursday, August 28, 2025 7:07 PM
To: Penny, Zheng <[email protected]>
Cc: Huang, Ray <[email protected]>; Anthony PERARD <[email protected]>; Andrew Cooper <[email protected]>; Roger Pau Monné <[email protected]>; [email protected]
Subject: Re: [PATCH v8 8/8] xen/cpufreq: Adapt SET/GET_CPUFREQ_CPPC xen_sysctl_pm_op for amd-cppc driver

Review static int get_cpufreq_para(struct xen_sysctl_pm_op

Quoted 1 line · Penny Zheng
(quoted diff) +0 -0
@@ -154,6 +156,17 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op

*op)

Quoted 4 lines
xen/drivers/acpi/pm-op.c +0 -0
     else
         strlcpy(op->u.get_para.scaling_driver, "Unknown",
 CPUFREQ_NAME_LEN);
 

xen/drivers/acpi/pm-op.c static int get_cpufreq_para(struct xen_sysctl_pm_op *op) · line 168

Quoted 10 lines
xen/drivers/acpi/pm-op.c +10 -0
+    /*
+     * In CPPC active mode, we are borrowing governor field to indicate
+     * policy info.
+     */
+    if ( policy->governor->name[0] )
+        strlcpy(op->u.get_para.u.s.scaling_governor,
+                policy->governor->name, CPUFREQ_NAME_LEN);
+    else
+        strlcpy(op->u.get_para.u.s.scaling_governor, "Unknown",
+                CPUFREQ_NAME_LEN);

Isn't pulling this ...

Quoted 8 lines
Quoted 6 lines

xen/drivers/acpi/pm-op.c static int get_cpufreq_para(struct xen_sysctl_pm_op *op) · line 172

Quoted 3 lines
xen/drivers/acpi/pm-op.c +0 -0
     if ( !cpufreq_is_governorless(op->cpuid) )
     {
         if ( !(scaling_available_governors =

... out of this if()'s body going to affect HWP? It's not clear to me whether that would be entirely benign.

HWP has its own unique "hwp" governor. So, imo, it may not affect.

How does it matter what (unique or not) governor it uses? The relevant aspect (to me) is the !cpufreq_is_governorless() check that previously guarded the copying of the name. (It would be another thing if this was benign to HWP, but such would need clarifying in the description. Cc-ing Jason just in case.)

Jan

#4 lore raw

[Public]

Quoted 53 lines

-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: Wednesday, September 3, 2025 2:22 PM
To: Penny, Zheng <[email protected]>
Cc: Huang, Ray <[email protected]>; Anthony PERARD <[email protected]>; Andrew Cooper <[email protected]>; Roger Pau Monné <[email protected]>; [email protected]; Andryuk, Jason <[email protected]>
Subject: Re: [PATCH v8 8/8] xen/cpufreq: Adapt SET/GET_CPUFREQ_CPPC xen_sysctl_pm_op for amd-cppc driver

Quoted 41 lines · Zheng

[Public]

Quoted 38 lines

-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: Thursday, August 28, 2025 7:07 PM
To: Penny, Zheng <[email protected]>
Cc: Huang, Ray <[email protected]>; Anthony PERARD <[email protected]>; Andrew Cooper <[email protected]>; Roger Pau Monné <[email protected]>; [email protected]
Subject: Re: [PATCH v8 8/8] xen/cpufreq: Adapt SET/GET_CPUFREQ_CPPC xen_sysctl_pm_op for amd-cppc driver

Quoted 2 lines · Penny Zheng
(quoted diff) +0 -0
@@ -154,6 +156,17 @@ static int get_cpufreq_para(struct

xen_sysctl_pm_op

*op)

Quoted 4 lines
     else
         strlcpy(op->u.get_para.scaling_driver, "Unknown",

CPUFREQ_NAME_LEN);

xen/drivers/acpi/pm-op.c static int get_cpufreq_para(struct xen_sysctl_pm_op *op) · line 168

Quoted 10 lines
xen/drivers/acpi/pm-op.c +10 -0
+    /*
+     * In CPPC active mode, we are borrowing governor field to indicate
+     * policy info.
+     */
+    if ( policy->governor->name[0] )
+        strlcpy(op->u.get_para.u.s.scaling_governor,
+                policy->governor->name, CPUFREQ_NAME_LEN);
+    else
+        strlcpy(op->u.get_para.u.s.scaling_governor, "Unknown",
+                CPUFREQ_NAME_LEN);

Isn't pulling this ...

Quoted 3 lines
     if ( !cpufreq_is_governorless(op->cpuid) )
     {
         if ( !(scaling_available_governors =

... out of this if()'s body going to affect HWP? It's not clear to me whether that would be entirely benign.

Quoted 6 lines
Quoted 1 line

HWP has its own unique "hwp" governor. So, imo, it may not affect.

How does it matter what (unique or not) governor it uses? The relevant aspect (to me) is the !cpufreq_is_governorless() check that previously guarded the copying of the name. (It would be another thing if this was benign to HWP, but such would need clarifying in the description. Cc-ing Jason just in case.)

Sorry, What I mean is that HWP do have a governor, so such copying of the name shall be benign to the HWP. I'll clarify it in the description

Quoted 2 lines

Jan

#5 lore raw
Quoted 55 lines · Zheng

[Public]

Quoted 53 lines

-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: Wednesday, September 3, 2025 2:22 PM
To: Penny, Zheng <[email protected]>
Cc: Huang, Ray <[email protected]>; Anthony PERARD <[email protected]>; Andrew Cooper <[email protected]>; Roger Pau Monné <[email protected]>; [email protected]; Andryuk, Jason <[email protected]>
Subject: Re: [PATCH v8 8/8] xen/cpufreq: Adapt SET/GET_CPUFREQ_CPPC xen_sysctl_pm_op for amd-cppc driver

Quoted 41 lines · Zheng

[Public]

Quoted 38 lines

-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: Thursday, August 28, 2025 7:07 PM
To: Penny, Zheng <[email protected]>
Cc: Huang, Ray <[email protected]>; Anthony PERARD <[email protected]>; Andrew Cooper <[email protected]>; Roger Pau Monné <[email protected]>; [email protected]
Subject: Re: [PATCH v8 8/8] xen/cpufreq: Adapt SET/GET_CPUFREQ_CPPC xen_sysctl_pm_op for amd-cppc driver

Quoted 2 lines · Penny Zheng
(quoted diff) +0 -0
@@ -154,6 +156,17 @@ static int get_cpufreq_para(struct

xen_sysctl_pm_op

*op)

Quoted 4 lines
     else
         strlcpy(op->u.get_para.scaling_driver, "Unknown",

CPUFREQ_NAME_LEN);

xen/drivers/acpi/pm-op.c static int get_cpufreq_para(struct xen_sysctl_pm_op *op) · line 168

Quoted 10 lines
xen/drivers/acpi/pm-op.c +10 -0
+    /*
+     * In CPPC active mode, we are borrowing governor field to indicate
+     * policy info.
+     */
+    if ( policy->governor->name[0] )
+        strlcpy(op->u.get_para.u.s.scaling_governor,
+                policy->governor->name, CPUFREQ_NAME_LEN);
+    else
+        strlcpy(op->u.get_para.u.s.scaling_governor, "Unknown",
+                CPUFREQ_NAME_LEN);

Isn't pulling this ...

Quoted 3 lines
     if ( !cpufreq_is_governorless(op->cpuid) )
     {
         if ( !(scaling_available_governors =

... out of this if()'s body going to affect HWP? It's not clear to me whether that would be entirely benign.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

HWP has its own unique "hwp" governor. So, imo, it may not affect.

How does it matter what (unique or not) governor it uses? The relevant aspect (to me) is the !cpufreq_is_governorless() check that previously guarded the copying of the name. (It would be another thing if this was benign to HWP, but such would need clarifying in the description. Cc-ing Jason just in case.)

Sorry, What I mean is that HWP do have a governor, so such copying of the name shall be benign to the HWP. I'll clarify it in the description

FTAOD - "shall" isn't enough, it needs to be (provably) "is".

Jan

#6 lore raw
In reply to Penny, Zheng
Quoted 36 lines · Zheng

[Public]

Quoted 34 lines

-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: Thursday, August 28, 2025 7:07 PM
To: Penny, Zheng <[email protected]>
Cc: Huang, Ray <[email protected]>; Anthony PERARD <[email protected]>; Andrew Cooper <[email protected]>; Roger Pau Monné <[email protected]>; [email protected]
Subject: Re: [PATCH v8 8/8] xen/cpufreq: Adapt SET/GET_CPUFREQ_CPPC xen_sysctl_pm_op for amd-cppc driver

Review static int get_cpufreq_para(struct xen_sysctl_pm_op

Quoted 1 line · Penny Zheng
(quoted diff) +0 -0
@@ -154,6 +156,17 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op

*op)

Quoted 4 lines
xen/drivers/acpi/pm-op.c +0 -0
      else
          strlcpy(op->u.get_para.scaling_driver, "Unknown",
 CPUFREQ_NAME_LEN);
 

xen/drivers/acpi/pm-op.c static int get_cpufreq_para(struct xen_sysctl_pm_op *op) · line 168

Quoted 10 lines
xen/drivers/acpi/pm-op.c +10 -0
+    /*
+     * In CPPC active mode, we are borrowing governor field to indicate
+     * policy info.
+     */
+    if ( policy->governor->name[0] )
+        strlcpy(op->u.get_para.u.s.scaling_governor,
+                policy->governor->name, CPUFREQ_NAME_LEN);
+    else
+        strlcpy(op->u.get_para.u.s.scaling_governor, "Unknown",
+                CPUFREQ_NAME_LEN);

Isn't pulling this ...

Quoted 3 lines
xen/drivers/acpi/pm-op.c +0 -0
      if ( !cpufreq_is_governorless(op->cpuid) )
      {
          if ( !(scaling_available_governors =
Quoted 5 lines
Quoted 3 lines

... out of this if()'s body going to affect HWP? It's not clear to me whether that would be entirely benign.

HWP has its own unique "hwp" governor. So, imo, it may not affect.

get_hwp_para() writes into the same union:
op->u.get_para.u.cppc_para
op->u.get_para.u.s.scaling_governor

Which is why I avoided it for hwp.

I guess writing scaling_governor first and then overwriting it still ends up with the same data in cppc_para. Seems a little messy though.

Penny, I'm confused by this comment:
+ /*

+     * In CPPC active mode, we are borrowing governor field to indicate
+     * policy info.
+     */

You have CPPC active and passive modes - which uses a governor and which uses get_cppc?

It seems like only writing the scaling governor inside if ( !cpufreq_is_governorless )

should be correct since it's using the union. Am I missing something?

Thanks,
Jason

#7 lore raw
Quoted 41 lines · Jason Andryuk
Quoted 40 lines · Zheng

[Public]

Quoted 37 lines

-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: Thursday, August 28, 2025 7:07 PM
To: Penny, Zheng <[email protected]>
Cc: Huang, Ray <[email protected]>; Anthony PERARD <[email protected]>; Andrew Cooper <[email protected]>; Roger Pau Monné <[email protected]>; [email protected]
Subject: Re: [PATCH v8 8/8] xen/cpufreq: Adapt SET/GET_CPUFREQ_CPPC xen_sysctl_pm_op for amd-cppc driver

Review static int get_cpufreq_para(struct xen_sysctl_pm_op

Quoted 1 line · Penny Zheng
(quoted diff) +0 -0
@@ -154,6 +156,17 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op

*op)

Quoted 4 lines
xen/drivers/acpi/pm-op.c +0 -0
      else
          strlcpy(op->u.get_para.scaling_driver, "Unknown",
 CPUFREQ_NAME_LEN);
 

xen/drivers/acpi/pm-op.c static int get_cpufreq_para(struct xen_sysctl_pm_op *op) · line 168

Quoted 10 lines
xen/drivers/acpi/pm-op.c +10 -0
+    /*
+     * In CPPC active mode, we are borrowing governor field to indicate
+     * policy info.
+     */
+    if ( policy->governor->name[0] )
+        strlcpy(op->u.get_para.u.s.scaling_governor,
+                policy->governor->name, CPUFREQ_NAME_LEN);
+    else
+        strlcpy(op->u.get_para.u.s.scaling_governor, "Unknown",
+                CPUFREQ_NAME_LEN);

Isn't pulling this ...

xen/drivers/acpi/pm-op.c static int get_cpufreq_para(struct xen_sysctl_pm_op *op) · line 172

Quoted 3 lines
xen/drivers/acpi/pm-op.c +0 -0
      if ( !cpufreq_is_governorless(op->cpuid) )
      {
          if ( !(scaling_available_governors =

... out of this if()'s body going to affect HWP? It's not clear to me whether that would be entirely benign.

Quoted 5 lines
Quoted 1 line

HWP has its own unique "hwp" governor. So, imo, it may not affect.

get_hwp_para() writes into the same union:
op->u.get_para.u.cppc_para
op->u.get_para.u.s.scaling_governor

Not anymore as of "tools/cpufreq: extract CPPC para from cpufreq para".

Quoted 11 lines

Which is why I avoided it for hwp.

I guess writing scaling_governor first and then overwriting it still ends up with the same data in cppc_para. Seems a little messy though.

Penny, I'm confused by this comment:

xen/drivers/acpi/pm-op.c +4 -0
+    /*
+     * In CPPC active mode, we are borrowing governor field to indicate
+     * policy info.
+     */
Quoted 7 lines

You have CPPC active and passive modes - which uses a governor and which uses get_cppc?

It seems like only writing the scaling governor inside if ( !cpufreq_is_governorless )

should be correct since it's using the union. Am I missing something?

The union is now fake; it has just a single member, and hence would better be dropped. I've commented correspondingly on v9.

Jan