[PATCH 0/8] enable x86_energy_perf_policy for AMD CPU

From: Perry Yuan
Date: Mon Jan 29 2024 - 22:19:15 EST



Hi all,
This patch series introduces support for the x86_energy_perf_policy utility on AMD processors that
utilize the CPPC (Collaborative Processor Performance Control) interface for frequency scaling,
using the amd_pstate driver module. AMD processors already support various
Energy Performance Preference (EPP) profiles. With this utility, users can now seamlessly
switch between these EPP profiles using the provided commands. And check the CPPC capabilities
with this tool.
This enhancement aims to improve power efficiency and performance management for AMD processors,
providing users with more control over their system's energy-performance behavior.

There are some EPP profile already support by AMD processors, user can
switch EPP profile listed below with the utility commands.

User can change EPP profile like this:
$ sudo x86_energy_perf_policy --hwp-epp performance
$ sudo x86_energy_perf_policy --hwp-epp balance-performance
$ sudo x86_energy_perf_policy --hwp-epp balance_power
$ sudo x86_energy_perf_policy --hwp-epp power

0 performance
128 balance_performance (default)
192 balance_power
255 power


It also supports to check CPPC capabilities and change EPP profiles
at runtime.

$ sudo x86_energy_perf_policy
cpu0: [AMD HWP_REQ]: lowest 13 highest 166 desired 0 epp 128 window 0x7829a7d0 (80*10^7us) use_pkg 87
cpu0: [AMD HWP_CAP]: low 13 lowest_non 68 nominal 77 highest 166

cpu1: [AMD HWP_REQ]: lowest 13 highest 166 desired 0 epp 128 window 0x7829a7d0 (80*10^7us) use_pkg 87
cpu1: [AMD HWP_CAP]: low 13 lowest_non 68 nominal 77 highest 166

cpu2: [AMD HWP_REQ]: lowest 13 highest 166 desired 0 epp 128 window 0x7829a7d0 (80*10^7us) use_pkg 87
cpu2: [AMD HWP_CAP]: low 13 lowest_non 68 nominal 77 highest 166

cpu3: [AMD HWP_REQ]: lowest 13 highest 166 desired 0 epp 128 window 0x7829a7d0 (80*10^7us) use_pkg 87
cpu3: [AMD HWP_CAP]: low 13 lowest_non 68 nominal 77 highest 166

cpu4: [AMD HWP_REQ]: lowest 13 highest 166 desired 0 epp 128 window 0x7829a7d0 (80*10^7us) use_pkg 87
cpu4: [AMD HWP_CAP]: low 13 lowest_non 68 nominal 77 highest 166


Any feedback are apprea

Perry Yuan (8):
tools/power x86_energy_perf_policy: add info show support for AMD
Pstate EPP driver
tools/power x86_energy_perf_policy: enable AMD pstate EPP profile
switching on MSR based system
tools/power x86_energy_perf_policy: rename get_msr() and put_msr()
with intel prefix
tools/power x86_energy_perf_policy: rename get_cpuid_or_exit() with
intel prefix
tools/power x86_energy_perf_policy: add nominal and lowest nonlinear
perf values showing support
tools/power x86_energy_perf_policy: remove the invalid feature options
for AMD processors
tools/power x86_energy_perf_policy: rename some perf output strings
for AMD processors
tools/power x86_energy_perf_policy: change intel msr functions to be
static

.../x86_energy_perf_policy | Bin 0 -> 50808 bytes
.../x86_energy_perf_policy.c | 355 +++++++++++++-----
2 files changed, 271 insertions(+), 84 deletions(-)
create mode 100755 tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy

--
2.34.1