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

[PATCH v1 08/11] x86/cpufreq: add "cpufreq=amd-pstate,active" para


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Penny Zheng <Penny.Zheng@xxxxxxx>
  • Date: Tue, 3 Dec 2024 16:11:08 +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=ruSsC38qnvGR7EDsFK/ZZZZT5Bp/vYDQpQsoiYuXqPY=; b=pObgZN9d+Q3EhqlE17BJX1r3wFhHpGRHGZwy7KyWbwE6JsQCMBlGnLaAN6EmItDN2ikKNEHz1mkKOR4kJt4CyWTyVJA9IpNCldVUt7VxwK349Sez3PZAS9TFVV99AEYspjoaxR2O5U2T3+NoRcNYnX2/3wOlLfQC+cV+R0pELUJsTp8nweutueG5Z6vSN6yRgyPTSjRQVAjpNwlki3y333bhf+JezHLVCMfy5XMs1JxmPOdutYPUaf3sIyZ9+OHDCEo5CRtQ0IMZbbL7BtKkNl5wgwsDISsNOI/MrLdu+UraVIygUTcgK/XUnqcxYy+BLPKrdDpXLqvtjjStT9hcJg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PZpvVohbClks+20ir+fgAFpRF1CEOAjAMP+JPJq3QuomFFphqMRrYTowrd+yOU8zPBkjuPlmTjisIT3LLliFjTipkBgS9X4yAYO0aXRDe8Ys6z4BQPHlwnLeGiuJO1rH/B6BwWU4IrclMaWR6dwa2tkVDMUSKqJWae+spamFXBDkYLVOEYleQq2BivEhwzIxBYdU8GxA6KCJJmsZPHOsWpBrFbJAqB+FffJuZDzWNCipJBp6vu4ov+N+AFbte2k5QN1T84S++sKbfFvm/675gkdtak0ZQumjXK1b91bItWRwFiRBe30tQdjLT+EAFDQr7F5qTRNL9rQZ0WFJqAul8A==
  • Cc: <stefano.stabellini@xxxxxxx>, <Ray.Huang@xxxxxxx>, <Xenia.Ragiadakou@xxxxxxx>, <Jason.Andryuk@xxxxxxx>, <penny.zheng@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>
  • Delivery-date: Tue, 03 Dec 2024 08:22:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Penny Zheng <penny.zheng@xxxxxxx>

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

Introduce a new variable to keep track of which mode is currently enabled.
This variable will also help to choose which cpufreq driver to be registered.

Signed-off-by: Penny Zheng <Penny.Zheng@xxxxxxx>
---
 docs/misc/xen-command-line.pandoc      |  9 ++++++++-
 xen/arch/x86/acpi/cpufreq/amd-pstate.c | 12 +++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc 
b/docs/misc/xen-command-line.pandoc
index 30f855fa18..a9a3e0ef79 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -499,7 +499,8 @@ 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-pstate[:[verbose]]`
+> `= none | {{ <boolean> | xen } { 
[:[powersave|performance|ondemand|userspace][,[<maxfreq>]][,[<minfreq>]]] }
+[,verbose]} | dom0-kernel | hwp[:[<hdc>][,verbose]] | 
amd-pstate[:[active][,verbose]]`
 
 > Default: `xen`
 
@@ -522,6 +523,12 @@ choice of `dom0-kernel` is deprecated and not supported by 
all Dom0 kernels.
   on supported AMD hardware to provide a finer grained frequency control 
mechanism.
   The default is disabled. If `amd-pstate` is selected, but hardware support
   is not available, Xen will fallback to cpufreq=xen.
+* `active` is a boolean to enable amd-pstate 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 themal, 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-pstate.c 
b/xen/arch/x86/acpi/cpufreq/amd-pstate.c
index 5dfa35581a..43abdd8636 100644
--- a/xen/arch/x86/acpi/cpufreq/amd-pstate.c
+++ b/xen/arch/x86/acpi/cpufreq/amd-pstate.c
@@ -27,6 +27,8 @@
 #define amd_pstate_warn(fmt, args...) \
     printk(XENLOG_WARNING "AMD_PSTATE: CPU%u warning: " fmt, cpu, ## args)
 
+static bool __ro_after_init opt_cpufreq_active = false;
+
 struct amd_pstate_drv_data
 {
     struct xen_processor_cppc *cppc_data;
@@ -76,6 +78,13 @@ static bool __init amd_pstate_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;
 }
 
@@ -398,5 +407,6 @@ int __init amd_pstate_register_driver(void)
     if ( !cpu_has_cppc )
         return -ENODEV;
 
-    return cpufreq_register_driver(&amd_pstate_cpufreq_driver);
+    if ( !opt_cpufreq_active )
+        return cpufreq_register_driver(&amd_pstate_cpufreq_driver);
 }
-- 
2.34.1




 


Rackspace

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