]> xenbits.xensource.com Git - people/aperard/xen-unstable.git/commitdiff
xen/cpufreq: only set gov NULL when cpufreq_driver.setpolicy is NULL
authorPenny Zheng <Penny.Zheng@amd.com>
Mon, 14 Apr 2025 11:10:55 +0000 (13:10 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 14 Apr 2025 11:10:55 +0000 (13:10 +0200)
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@amd.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/drivers/cpufreq/cpufreq.c

index 4a103c6de91c6406adf39e67f2cf8d9e5ce4bb6b..19e29923356a549a8a66ca27ea16d649278e8fdc 100644 (file)
@@ -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);