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

[PATCH v1 00/11] amd-pstate CPU Performance Scaling Driver


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Penny Zheng <Penny.Zheng@xxxxxxx>
  • Date: Tue, 3 Dec 2024 16:11:00 +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=2LbG/8IIub4wmb2kCfj2ltWzhRP860ymQnZzHFTwDL8=; b=V96EQabQaaFuFLUpJ2I6N15R8PXVpzoRuGuB78ZKZrug15quF4oZ3hCv/B3X9bBIFnoi4oVvDl4V6rRWIgFAfYUYzKAQlYNLDtW0xo+8BpLfl2N6VKnlhrptuzGUp/f0lGmYa3KdjDSP3KKxjFySbcBj85DCbqsFOAJqmEOzK3JQ6ZnHSQPHqxB6Eg836KuoZqW15m0P92JKt9JUjofz7yCVp6GIuC4sFzqfKNoEi5oSqU8FKdkL2cFQ6o3JOt+PDGIQffdDdt7h1VuG9nI++dTGmQqnadk57+7yLbXttUW9OtAHge+q/r2BlphyBFMjwir0HRJOVkQlWRx3cwLp3Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=W/kZ9Joc87vuAm1mqEjUhAqu7vQSfyLUoD/o4/CnKCJ3/VEhHJM87UFgbMraxZSoMMyT+pSEoZzyiH/kCCvBQyfnzmyTTaW1ltXvMyme4G+uYK5qo/+BSqhp2v+54M9tCVWHdLqDHl5SDZtCgp6pEhLCFVYhkJq+hA7n4WoGioG89urvekrwOOhBJNdd9BLfLKnphkzK4r255DMokh7/qjhEFLjhrbruWxOxoML+8BWwl6Vc0VrhXlVj3K/jwOwuztvUaY59Qxew0Ayx8KCdgByxH4D/yy5vvOn7U+9xZUwmh3NbITJCkxtBoADLg8oWdx0XF7IdkX2wg6mJhKM+tw==
  • Cc: <stefano.stabellini@xxxxxxx>, <Ray.Huang@xxxxxxx>, <Xenia.Ragiadakou@xxxxxxx>, <Jason.Andryuk@xxxxxxx>, <penny.zheng@xxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, "Andrew Cooper" <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Tue, 03 Dec 2024 08:22:09 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

amd-pstate is the AMD CPU performance scaling driver that introduces a
new CPU frequency control mechanism on modern AMD APU and CPU series in
Xen. The new mechanism is based on Collaborative Processor Performance
Control (CPPC) which provides finer grain frequency management than
legacy ACPI hardware P-States. Current AMD CPU/APU platforms are using
the ACPI P-states driver to manage CPU frequency and clocks with
switching only in 3 P-states. CPPC replaces the ACPI P-states controls
and allows a flexible, low-latency interface for Xen to directly
communicate the performance hints to hardware.

amd_pstate CPPC has 2 operation modes: autonomous (active) mode,
and non-autonomous (passive) mode. We register different CPUFreq driver
for different modes, "amd-pstate" for passive mode and "amd-pstate-epp"
for active mode.

The passive mode leverages common governors such as *ondemand*,
*performance*, etc, to manage the performance hints. And the active mode
uses epp to provides a hint to the hardware if software wants to bias
toward performance (0x0) or energy efficiency (0xff). CPPC power algorithm
will calculate the runtime workload and adjust the realtime cpu cores
frequency according to the power supply and thermal, core voltage and some
other hardware conditions.

amd-pstate is enabled with a top-level cpufreq=amd-pstate option. It will
fallback to cpufreq=xen if amd-pstate is unavailable.

With `cpufreq=amd-pstate,active`, We did a 60s sampling test to see the CPU
frequency change, through tweaking the energy_perf preference from
`xenpm set-cpufreq-cppc powersave` to `xenpm set-cpufreq-cppc performance`.
The outputs are as follows:
```
Setting CPU in powersave mode
Sampling and Outputs:
  Avg freq      2000000 KHz
  Avg freq      2000000 KHz
  Avg freq      2000000 KHz
Setting CPU in performance mode
Sampling and Outputs:
  Avg freq      4640000 KHz
  Avg freq      4220000 KHz
  Avg freq      4640000 KHz
```

Penny Zheng (11):
  xen/x86: add CPPC feature flag for AMD processors
  xen/x86: introduce new sub-hypercall to get CPPC data
  xen/x86: introduce "cpufreq=amd-pstate" xen cmdline
  xen/x86: get processor max speed from DMI table
  xen/x86: introduce a new amd pstate driver for cpufreq scaling
  xen/cpufreq: introduce policy type when cpufreq_driver->setpolicy
    exists
  xen/cpufreq: only set gov NULL when cpufreq_driver.target() exists
  x86/cpufreq: add "cpufreq=amd-pstate,active" para
  xen/x86: implement EPP support for the AMD processors
  tools/xenpm: Print CPPC parameters for amd-pstate driver
  xen/cpufreq: Adapt SET/GET_CPUFREQ_CPPC xen_sysctl_pm_op for
    amd-pstate driver

 docs/misc/xen-command-line.pandoc           |  15 +-
 tools/misc/xenpm.c                          |  19 +-
 xen/arch/x86/acpi/cpufreq/Makefile          |   1 +
 xen/arch/x86/acpi/cpufreq/amd-pstate.c      | 641 ++++++++++++++++++++
 xen/arch/x86/acpi/cpufreq/cpufreq.c         |  28 +
 xen/arch/x86/acpi/cpufreq/hwp.c             |  10 +-
 xen/arch/x86/dmi_scan.c                     |  19 +
 xen/arch/x86/include/asm/cpufeature.h       |   1 +
 xen/arch/x86/include/asm/msr-index.h        |   5 +
 xen/arch/x86/platform_hypercall.c           |  12 +
 xen/arch/x86/x86_64/cpufreq.c               |  18 +
 xen/arch/x86/x86_64/platform_hypercall.c    |   3 +
 xen/drivers/acpi/pmstat.c                   |  24 +-
 xen/drivers/cpufreq/cpufreq.c               |  71 ++-
 xen/drivers/cpufreq/utility.c               |  11 +
 xen/include/acpi/cpufreq/cpufreq.h          |  27 +
 xen/include/acpi/cpufreq/processor_perf.h   |   1 +
 xen/include/public/arch-x86/cpufeatureset.h |   1 +
 xen/include/public/platform.h               |  12 +
 xen/include/public/sysctl.h                 |   3 +-
 xen/include/xen/dmi.h                       |   5 +
 xen/include/xen/pmstat.h                    |   3 +
 xen/include/xlat.lst                        |   1 +
 23 files changed, 910 insertions(+), 21 deletions(-)
 create mode 100644 xen/arch/x86/acpi/cpufreq/amd-pstate.c

-- 
2.34.1




 


Rackspace

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