[PATCH v5 07/18] xen/cpufreq: disable px statistic info in amd-cppc mode

Penny Zheng posted 18 patches 5 months, 1 week ago
There is a newer version of this series
[PATCH v5 07/18] xen/cpufreq: disable px statistic info in amd-cppc mode
Posted by Penny Zheng 5 months, 1 week ago
We want to bypass construction of px statistic info, while not bypassing
cpufreq_statistic_lock initialization for a good reason, in
cpufreq_statistic_init() for amd-cppc mode, as P-states is not necessary there.

Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
v3 -> v4:
- remove unnecessary stub for cpufreq_statistic_exit()
---
v4 -> v5:
- refactor commit message
---
 xen/drivers/cpufreq/utility.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/drivers/cpufreq/utility.c b/xen/drivers/cpufreq/utility.c
index e690a484f1..b35e2eb1b6 100644
--- a/xen/drivers/cpufreq/utility.c
+++ b/xen/drivers/cpufreq/utility.c
@@ -98,6 +98,9 @@ int cpufreq_statistic_init(unsigned int cpu)
     if ( !pmpt )
         return -EINVAL;
 
+    if ( !(pmpt->init & XEN_PX_INIT) )
+        return 0;
+
     spin_lock(cpufreq_statistic_lock);
 
     pxpt = per_cpu(cpufreq_statistic_data, cpu);
-- 
2.34.1
Re: [PATCH v5 07/18] xen/cpufreq: disable px statistic info in amd-cppc mode
Posted by Jan Beulich 4 months, 2 weeks ago
On 27.05.2025 10:48, Penny Zheng wrote:
> We want to bypass construction of px statistic info, while not bypassing
> cpufreq_statistic_lock initialization for a good reason, in
> cpufreq_statistic_init() for amd-cppc mode, as P-states is not necessary there.
> 
> Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
> Acked-by: Jan Beulich <jbeulich@suse.com>

I was considering to put this in together with patch 02 (if and when you confirmed
that it can go in with the one hunk dropped), but then noticed that ...

> --- a/xen/drivers/cpufreq/utility.c
> +++ b/xen/drivers/cpufreq/utility.c
> @@ -98,6 +98,9 @@ int cpufreq_statistic_init(unsigned int cpu)
>      if ( !pmpt )
>          return -EINVAL;
>  
> +    if ( !(pmpt->init & XEN_PX_INIT) )
> +        return 0;

... this check is pointless with how things are right now (the same check living at
the top of the sole caller). Hence I think this change should be folded into patch
04. Perhaps to be accompanied by a sentence why cpufreq_statistic_exit() doesn't
need a similar guard.

Jan