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

[PATCH v2 07/11] x86/cpufreq: add "cpufreq=amd-cppc,active" para


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Penny Zheng <Penny.Zheng@xxxxxxx>
  • Date: Thu, 6 Feb 2025 16:32:51 +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=6Rt9esRODwdhmRPre4CEkWV3Z2Y80I1RmtW4o743N6Y=; b=wWJ/KA1WKh7ymYZOtvIv3R2KtEzMvqf2X9hn5nqCP3S+iGGuBXVdNtZ7Ir0rA9DZH+XiYwiAdf9Ova/wiRFEcF8f3tN6DpiZ+JjXzC5Z7fH7jtTXImeLwaGT1o0jb6hhoWNg4C0+8pqD7mwH8QIRJFaVSzAam8Gz6EVOLfkNblP0i8QN7OgkrXBObgImXS7cPGUyEMYwCNu1mBLEm5ktA/Tle0yUZdFbc1nG08e0gcKpjPTaqx0EYKDuv9dxfPIeAOIj2dsAUe1oSH5Rg0FzfjOyzKBE1BZ9oCXAeJwPkFDvF1ieNdM9hVmsy5YGfU9GLmqcav9cS+KK6TnkM1cHcQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=B45LA+5wao4HpZlDtbHQM815XLh68NXlB3I2dbJKeRg64SlHFvAsu2/kES0nB3XpqcffRQLVpGwy3c1+Vytni5og+tfQGjiJ3N3DZ4Tz9XJYoduRFXSeUX7aCTi2v0VHFAMvntI1hstSQgTrl0NyIC8lsTK3J16cUD8VJPjdgt1j7/pv4pjPtwlpjcH/zwT64QwEEcqLxN50htTtXgSaMHIlfnWkxDF3Q74sj7sbGsRwXkdUtqEkqgQEvqo0UiKON4jMz7vbQxMmZ3KCkQ/po+9nwgDls9BQYWY5ohs/AI5cdtS7l9gOs2XsVjlMKkntLUbD8l9d1YYkYEXt33R3/w==
  • Cc: <Ray.Huang@xxxxxxx>, <Jason.Andryuk@xxxxxxx>, Penny Zheng <penny.zheng@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "Anthony PERARD" <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, "Jan Beulich" <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>
  • Delivery-date: Thu, 06 Feb 2025 08:33:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Penny Zheng <penny.zheng@xxxxxxx>

The amd-cppc driver may support multiple working modes, passive and active.

Introduce `active` tag for users to explicitly select active mode and a new
variable `opt_cpufreq_active` to keep track of which mode is currently enabled.
Specific implementation will be introduced in the following commits.

Signed-off-by: Penny Zheng <Penny.Zheng@xxxxxxx>
---
v1 -> v2:
- Remove pointless initializer
- Move driver registration change to the next commit
---
 docs/misc/xen-command-line.pandoc    | 8 +++++++-
 xen/arch/x86/acpi/cpufreq/amd-cppc.c | 9 +++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/docs/misc/xen-command-line.pandoc 
b/docs/misc/xen-command-line.pandoc
index 78cfb8a02e..13f650270d 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -515,7 +515,7 @@ If set, force use of the performance counters for oprofile, 
rather than detectin
 available support.
 
 ### cpufreq
-> `= none | {{ <boolean> | xen } { 
[:[powersave|performance|ondemand|userspace][,[<maxfreq>]][,[<minfreq>]]] } 
[,verbose]} | dom0-kernel | hwp[:[<hdc>][,verbose]] | amd-cppc[:[verbose]]`
+> `= none | {{ <boolean> | xen } { 
[:[powersave|performance|ondemand|userspace][,[<maxfreq>]][,[<minfreq>]]] } 
[,verbose]} | dom0-kernel | hwp[:[<hdc>][,verbose]] | 
amd-cppc[:[active][,verbose]]`
 
 > Default: `xen`
 
@@ -538,6 +538,12 @@ choice of `dom0-kernel` is deprecated and not supported by 
all Dom0 kernels.
   on supported AMD hardware to provide finer grained frequency control 
mechanism.
   The default is disabled. If `amd-cppc` is selected, but hardware support
   is not available, Xen will fallback to cpufreq=xen.
+* `active` is a boolean to enable amd-cppc driver in active(autonomous) mode.
+  In this mode, users could provide a hint with energy performance preference
+  register to the hardware if they want to bias toward performance(0x0) or
+  energy efficiency(0xff), then CPPC power algorithm will calculate the runtime
+  workload and adjust the realtime cores frequency according to the power 
supply
+  and thermal, core voltage and some other hardware conditions.
 
 There is also support for `;`-separated fallback options:
 `cpufreq=hwp;xen,verbose`.  This first tries `hwp` and falls back to `xen` if
diff --git a/xen/arch/x86/acpi/cpufreq/amd-cppc.c 
b/xen/arch/x86/acpi/cpufreq/amd-cppc.c
index f14e7a6638..1742c57170 100644
--- a/xen/arch/x86/acpi/cpufreq/amd-cppc.c
+++ b/xen/arch/x86/acpi/cpufreq/amd-cppc.c
@@ -33,6 +33,8 @@
 #define amd_cppc_warn(fmt, args...)                         \
     printk(XENLOG_WARNING "AMD_CPPC: CPU%u warning: " fmt, cpu, ## args)
 
+static bool __ro_after_init opt_cpufreq_active;
+
 struct amd_cppc_drv_data
 {
     struct xen_processor_cppc *cppc_data;
@@ -80,6 +82,13 @@ static bool __init amd_cppc_handle_option(const char *s, 
const char *end)
         return true;
     }
 
+    ret = parse_boolean("active", s, end);
+    if ( ret >= 0 )
+    {
+        opt_cpufreq_active = ret;
+        return true;
+    }
+
     return false;
 }
 
-- 
2.34.1




 


Rackspace

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