How to use AMD P-State in Linux

You only need amd_pstate=guided in your kernel cmdline and #reinstall-kernels if you are using systemd-boot, or a #grub-mkconfig -o /boot/grub/grub.cfg if you are running grub.

That and amd_pstate.shared_mem=1 are no longer necessary.

Then, check if it is running by:

$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver
amd-pstate

$ cat /sys/devices/system/cpu/amd_pstate/status
guided

cpupower frequency-info can also give you more details.

1 Like

Thanks! works perfectly!

1 Like

Gave ā€˜guided’ mode a quick try. While it scales nicely according to workload, balancing power usage and performance, it still uses slightly more power in governors other than powersave (which is not usable at all, stuck at 400 MHz throughout) compared to Active EPP with powersave governor. At least for my use case. Reverted back to said EPP mode, together with the convenience of switching between power modes with a slider, which is absent on ā€˜guided’.

Another observation: Idle power draw is identical with all governors in Guided or Active mode. (Idle being on desktop, no active network transfers, no apps opened)

on Desktop AMD Ryzen 9 5900X i can’t remove amd_pstate.shared_mem=1
where it seems to work setting: amd_pstate=guided
also am not sure if it is used as i still can set governors using cpupower-- may i need to disble cpupower daemon?

For my use case and setup running amd p-state with guided has so far provided the best results - meaning sufficiently low power consumption in idle and low load and still being responsive in high load scenarios.

My usual use case are sporadic high / extremely high loads when running big data or other scientific loads or using VM’s for those pesky few proprietary softwares (Damn you Nvivo!). Rest is mostly idle with loads of web browsing and word processing, with few games in between.

Setup is AMD 5900x and x570 board.

Idle package watts (read with turbostat) are around 24’is W, loads go up to 115W which concur with TDP and boosting.

Running following kernel arguments

initcall_blacklist=acpi_cpufreq_init amd_pstate=guided amd_pstate.enable=1

Governor etc info are

driver: amd-pstate
maximum transition latency: 20.0 us
hardware limits: 550 MHz - 4.95 GHz
available cpufreq governors: conservative ondemand userspace powersave performance schedutil
current policy: frequency should be within 550 MHz and 4.95 GHz.
The governor ā€œschedutilā€ may decide which speed to use within this range.
current CPU frequency: 4.30 GHz (asserted by call to kernel)
boost state support:
Supported: yes
Active: yes
AMD PSTATE Highest Performance: 166. Maximum Frequency: 4.95 GHz.
AMD PSTATE Nominal Performance: 124. Nominal Frequency: 3.70 GHz.

Not running cpupower daemon.

1 Like

Passive mode for me is a no go, I can feel some latency, high CPU spikes.

I didn’t feel any difference between guided and active modes. (B550-F | 5800x3D).
Both feel pretty good.

All it is required for me is to set amd_pstate= with the mode I want in my kernel cmdline.

cpupower has been updated recently and now it is compatible with amd_pstate, although I’m using it just to check, service is not currently enabled.

guided mode
analyzing CPU 2:
  driver: amd-pstate
  CPUs which run at the same hardware frequency: 2
  CPUs which need to have their frequency coordinated by software: 2
  maximum transition latency: 20.0 us
  hardware limits: 550 MHz - 4.55 GHz
  available cpufreq governors: conservative ondemand userspace powersave performance schedutil
  current policy: frequency should be within 550 MHz and 4.55 GHz.
                  The governor "schedutil" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 3.60 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    AMD PSTATE Highest Performance: 166. Maximum Frequency: 4.55 GHz.
    AMD PSTATE Nominal Performance: 124. Nominal Frequency: 3.40 GHz.
    AMD PSTATE Lowest Non-linear Performance: 64. Lowest Non-linear Frequency: 1.75 GHz.
    AMD PSTATE Lowest Performance: 21. Lowest Frequency: 550 MHz.

I’m using the active mode.

amd-pstate-epp

Since kernel 6.4, active mode is the default, you don’t need any kernel cmdline option for that, it will be enabled by default now.

1 Like

Okay I’ll try it now.

Edit: Nope!

[ricklinux@eos-plasma ~]$  cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver
acpi-cpufreq
[ricklinux@eos-plasma ~]$ 

:thinking:

Edit: If i set guided it shows amd-pstate but it makes fans run faster even at idle. I like active better.

1 Like

Hmm, weird.
If I remove the amd_pstate option from my kernel cmdline, I get amd-pstate-epp active mode by default.
According to this phonorix article, it should be enabled by default from 6.3 onward.

I can’t hear my fans, too much noise here because I live very near to a very busy road..
Perhaps this is happening to me and I didn’t notice it yet, I’ll try to confirm checking the RPMs in both modes to compare.

If i take the kernel parameter out it goes back to:

acpi-cpufreq

Based on what I’ve been reading about this, you should be able to remove that kernel entry and have amd-pstate-epp active mode by default.
I’ll remove it here to test, one sec .

Edit: Same thing happened to me, I’m kind of lost right now :thinking:
This behavior is new to Kernel 6.4 because as far as I remember, Kernel 6.3 was setting the default to amd-pstate-epp active mode.

$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver
acpi-cpufreq

Well I’m going to stick with this mode as it seems to be the best for me. I have my 100w Cpu set to ECO mode for 65w also. I don’t change anything else. I have never gotten into undervolting or any of that overclocking stuff in all my years of computers. I tend to stick with the manufacturers settings and change only minor things. I’m more concerned with firmware updates and making sure i have the latest UEFI Firmware (Bios). I feel that is the most important until at such time as the hardware is getting that old and updates are not supported anymore.

I’m ā€œdownvoltingā€ my CPU, all cores to -30mV, I have more performance according to CB23, I can sustain the boost for longer, less CPU temperatures and less overall power usage, thus more efficient.

I’m now using amd-pstate-epp active mode to confirm if my fans RPM will change.
My governors changed from schedutil to powersave.

amd-pstate use the default governors.
amd-pstate-epp has it owns governors, such as powersave and performance.

So, if you use amd-pstate-epp, cpupower should be up to date in case you enable it because the governors are different, schedutil is not even an option anymore.

active is available since 6.3, it will become the default in 6.5

1 Like

Thanks BS86, you clarified things now… :+1:

What do you mean? CPU power should be up to date?

$ LANG=C sudo pacman -Ss cpupower
extra/cpupower 6.3-2 (linux-tools) [installed]
    Linux kernel tool to examine and tune power saving related features of your processor

Previous versions of cpupower governors didn’t include amd-pstate-epp governors.

[ricklinux@eos-plasma ~]$ sudo pacman -Ss cpupower
[sudo] password for ricklinux: 
extra/cpupower 6.3-2 (linux-tools) [installed]
    Linux kernel tool to examine and tune power saving related features of your processor
[ricklinux@eos-plasma ~]$ 

Do i need to set anything?

image

Images got from: https://wiki.archlinux.org/title/CPU_frequency_scaling#top-page

Previous versions of cpupower didn’t include these new governors from amd-pstate-epp driver.
Since you already have it updated, you don’t need to do anything, unless you want to change the governor from powersave to performance.