[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] xen/cpufreq: only set gov NULL when cpufreq_driver.setpolicy is NULL



commit 7610180ff9e741bf1c29a9d0e9753e1ee818e0e4
Author:     Penny Zheng <Penny.Zheng@xxxxxxx>
AuthorDate: Mon Apr 14 13:10:55 2025 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Apr 14 13:10:55 2025 +0200

    xen/cpufreq: only set gov NULL when cpufreq_driver.setpolicy is NULL
    
    amd-cppc on active mode bypasses the scaling governor layer, and
    provides its own P-state selection algorithms in hardware. Consequently,
    when it is used, the driver's -> setpolicy() callback is invoked
    to register per-CPU utilization update callbacks, not the ->target()
    callback.
    
    So, only when cpufreq_driver.setpolicy is NULL, we need to deliberately
    set old gov as NULL to trigger the according gov starting.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@xxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/drivers/cpufreq/cpufreq.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c
index 4a103c6de9..19e2992335 100644
--- a/xen/drivers/cpufreq/cpufreq.c
+++ b/xen/drivers/cpufreq/cpufreq.c
@@ -307,7 +307,13 @@ int cpufreq_add_cpu(unsigned int cpu)
     if (hw_all || (cpumask_weight(cpufreq_dom->map) ==
                    perf->domain_info.num_processors)) {
         memcpy(&new_policy, policy, sizeof(struct cpufreq_policy));
-        policy->governor = NULL;
+
+        /*
+         * Only when cpufreq_driver.setpolicy == NULL, we need to deliberately
+         * set old gov as NULL to trigger the according gov starting.
+         */
+        if ( cpufreq_driver.setpolicy == NULL )
+            policy->governor = NULL;
 
         cpufreq_cmdline_common_para(&new_policy);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.