[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 06/11] 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 Feb 2025 16:32:50 +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=1Hz1GEYLJa7vPQedcCPO8eM34ofnu1/QtlZnDuyk9HI=; b=JLNA201OofxvzS0fSSr7CT4gCXPIHAx/d/nWmAhFRLbWZ13ZSFarsrEO2Wsv+t3XFeTINnvTIijQumbfXSopY1Yx4pGW9wUNkdXZ8RyU2V5dsuZRm6u/p3ZBskZ0+tCQDhlmK2HAAHqcEkzAYAeqlb2W2DgiaQ7/6krcA0JqA2fV8Qu3QAB54PX9R9qTXfqKk80lhrotactXxjfGZqE7YNZt9Tdi3KK9Mn9uRSQocBWa+E30X+R1RI2zKNEeY+SdjF1kI5TmX3Bbs75a5GbFBrZDsZPw6+7xezJu0yhHrJ5TfVhZ5DNIGGpf9a2GKvyw2kyfTc9pMmAWJ4moIsHHQQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CEUvd/ezxKK8H31HLK0Ad+XXwvpErFIs2sPXPXt7Z5aujikeeAz1qlo0/nKgR60n+qIt8HfX7zBDW/MGPDF1XDvYf4IR2ERC/X0iqXqSS4ESQWmBdJGQTH5u6kjeBjHCDMdfojQZj1+Dm6FVw3K3S86E0ENt6LQMWLupgtqRgBokiwDhP7q5j4UrqjpPHX3sgzA7PZUGSAXXVa50gE0NqbsUtPgdUvlNULYy6Qa9DKhk9G2N8ERFv+rhtAglNcj1LFBfGsjo5tKIvxVCD1sYm2xF0p8xn2nVQmf2sZtEomkeS0GFEF01Og2dzZDQG9RVZi8u3gbwgf6jW8K84e0Q/g==
- Cc: <Ray.Huang@xxxxxxx>, <Jason.Andryuk@xxxxxxx>, Penny Zheng <penny.zheng@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>
- Delivery-date: Thu, 06 Feb 2025 08:33:40 +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>
---
v1 -> v2:
- Change condition check to .setpolicy being NULL
---
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 c0c6dc4c42..860ae32c8a 100644
--- a/xen/drivers/cpufreq/cpufreq.c
+++ b/xen/drivers/cpufreq/cpufreq.c
@@ -317,7 +317,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);
--
2.34.1
|