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

[PATCH v1 07/11] xen/cpufreq: only set gov NULL when cpufreq_driver.target() exists


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Penny Zheng <Penny.Zheng@xxxxxxx>
  • Date: Tue, 3 Dec 2024 16:11:07 +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=0QP5qhZll8rzt3zPECYH2FuNf7IFpUiVXoJ+eD0kzQE=; b=YulXtlYwlYGAWLtwVoNft5q8dsXxCuFiA4hVUA1x7yPsIqckyAhkruBcwZP+Z7/5DNjbyTS39Uzda4mmljFSNSPS3p9uROd9YYiXMohr3RahaaQBy13H/FjhWDg52Rj8dkj6dBgLLaJ6D0//24+PNk/bDqGw9k7OOjZ3C93Y31gUkT/Nw8+LD13qqT7lK0kawPCJ2kS99mNHntvjjEOpRPOABNhDs64MpTZH6TBSTHUoQz4aWV/DlMV1H5YRIbQ1L5fqYUJ+IqM/myuvKTjTu4VcEmMdtxGKl28V4RugBEk0uW/augUODSAupOhWEXklFUBv68JE/N0RhpIYeEMOCg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HCasWjSrBn73oZePdaOjykvj9DvWfyLaNBvz4Pb65V2+d0slKzhKCtkau97Cj+F1gOjmzBsWv6TLpCyeSD/WI8hTXFu4v/alXuR9OBimag+c7POGBFYcYLM9+tq9I7ECQfC0dU+6Zn5IbcOR9oqcSp1KYNFBNWdtqW4bxUpN1uHpXU2UrDyd5arK4nTLfIYJM8/V9+YlrccIFF5O/9Oh42YeIDSo533NOc/0lOPOll0aGlQRgyfIvDXImhG0s15tfCUKMdAlj2mvrW1axAbwmUO3VReKXwtu6EmJUBHOctSu9TOU2XYMQk83D2ROXQWj2wz92gZVgV33KmpDiwh1qg==
  • Cc: <stefano.stabellini@xxxxxxx>, <Ray.Huang@xxxxxxx>, <Xenia.Ragiadakou@xxxxxxx>, <Jason.Andryuk@xxxxxxx>, <penny.zheng@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>
  • Delivery-date: Tue, 03 Dec 2024 08:22:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Penny Zheng <penny.zheng@xxxxxxx>

amd-pstate on active mode bypasses the scaling governor layer, and
provides its own P-state selection algorithms. 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.target() exists, we need to deliberately
set old gov as NULL to trigger the according gov starting.

Signed-off-by: Penny Zheng <Penny.Zheng@xxxxxxx>
---
 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 54d554aa4f..c170a2cb2b 100644
--- a/xen/drivers/cpufreq/cpufreq.c
+++ b/xen/drivers/cpufreq/cpufreq.c
@@ -316,7 +316,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.target exists, we need to deliberately set 
old gov as NULL
+        * to trigger the according gov starting.
+        */
+       if ( cpufreq_driver.target )
+            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®.