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

[PATCH v3 10/15] xen/cpufreq: only set gov NULL when cpufreq_driver.setpolicy is NULL


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Penny Zheng <Penny.Zheng@xxxxxxx>
  • Date: Thu, 6 Mar 2025 16:39:44 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AWoURI9UoGDnQV3zAsQtajok02PmR6ELhXOEUkvQD6w=; b=XL8EQKmSUGurOQM+pHx6gA/l6Z7OvnrPyAMDg1Pa1x1ahMWq1x15QEyIy7sI4FJh76++pVv04JNFCe7OOKzQVEG07BBZ1EwSyb2stK3VrS7Z/VZGLQWjJ1ocxokz+IGgE57ymH3xwZQ5rNdO1ZYTve4bx+7dIz+8nvBfiaoT3F3WdO5MstTHVVhCYeCOqhGoMnnGW2EYflBGyvZ5w2wID3cWS5M3E2hz4unNu/F/IhF5VpDlrnvjNK7Hhl9TsgxAmch9SIKkMM6KRJSLHHjKhNYCE8rujo0H20SxRcTsR3ujkA4el+lX9m2XX4itz/ha5+YjfW+4i+MQjmuJHeRCWw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cUdLrgISklfZGltEqej33jG5BfMxsu4kE9VUvHqQ9DBezZ4OBfmCPzICDxZBELRjCCJnHTI2ozACUDeK5BnG8nHeXhrYpW039mW2HusTRZuVxBIqUS6JgHCXYPr46a5X+D9/L7A007UQAOXoxXXGbQ0AAqj2jcjS8ivrz/c9tIFybBP3vP5wYVBn8UDm1SxwfgB/kLaPPoKSh5UdJfGMpMYKLfea8+oCZD1TyneDA/EKPFJEmsnJxbvhJcXMRIJiSf+xjZDo7rdpE1Vi9cUmpV/r4/N1G3xQxF6YsqOdjLehIgf7L7lFTvqu3k1xJ7lX3d89q9+zAaANKPM9FmqK6g==
  • Cc: <ray.huang@xxxxxxx>, Penny Zheng <penny.zheng@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>
  • Delivery-date: Thu, 06 Mar 2025 08:58:08 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Penny Zheng <penny.zheng@xxxxxxx>

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 792e4dc02c..8fc6e527c2 100644
--- a/xen/drivers/cpufreq/cpufreq.c
+++ b/xen/drivers/cpufreq/cpufreq.c
@@ -353,7 +353,13 @@ int cpufreq_add_cpu(unsigned int cpu)
     if (hw_all || (cpumask_weight(cpufreq_dom->map) ==
                    pmpt->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);
 
-- 
2.34.1




 


Rackspace

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