How to use AMD P-State in Linux

I’ve managed to solve my issues using an aggressive ondemand governor vs schedutil. Schedutil was causing performance problems along with using lower frequency on average vs ondemand being faster and using better clocks

1 Like

I’ve been considering patching it in and testing, arch pkgbuilds make doing that trivial

yet another update to p-state EPP has been committed, v4

and I also wrote an email to Phoronix asking him to please add p-state ondemand for his next round of p-state benchmarks - let’s see if he reads and does it

1 Like

According to kernel mailing list thread, EPP is going to have only balanced, performance and power savings profiles, so this means ondemand won’t be available ?

and new line “amd-pstate=active”

results are from Epyc Roma

i wrote my email yesterday xD
but yes, it looks like EPP won’t have ondemand, but AMD p-state still has it and according to the new table, still offers best PPW.

with EPP, PPW seems to not change at all with the different settings, and won’t reach AMD p-state ondemand levels.

1 Like

i have some issues with AMD Ryzen 9 5900X special using the linux-amd kernel version of the 6.0.x series…
Currently i can not use TLP per example i am on cpupower using sheduler to save power…
I do still see CPU temps running on over 70°C while doing nothing that calls the CPU hard… and in the next minute with nothing changed it goes down to 40°C … and really nothing that would cause any load to see on monitoring

I’m not seeing any issue like that, that’s strange though. This only happens with pstate?

i do not think its caused by p-state usage. but on my CPU i do not got the possibility to use a wide range of frequencies so… could be related…

That doesn’t sound right, with acpi driver its a bit narrower but not a ton. You should be getting between 550mhz-4.9ghz with pstate. Sounds like something is keeping your CPU from reaching idle frequency as even with a less that ideal cooler you should idle around 40c.

What CPU cooler?

AMD P-State is set to become the default with Kernel 6.1 - or not, the article kind of contradicts itself.

Merged to mainline on Friday as part of the “fixes” for Linux 6.1-rc7 is the set of patches to make amd-pstate a built-in driver so that it can take precedence over acpi-cpufreq by default

AMD isn’t yet encouraging the amd_pstate driver to be used by default but the plan for that is to happen once AMD P-State EPP is ready and merged.

1 Like

well well well …

the “fix” actually made it into 6.0.11 - and Arch activated AMD P-State as built-in:

With that change, at least on my 7700X AMD P-State is now the default scaling driver:

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

and:

cat  /etc/modules-load.d/amd-pstate.conf 
# Load amd pstate at boot
#amd_pstate

Edit:
same with:

cat  /etc/modules-load.d/amd-pstate.conf
cat: /etc/modules-load.d/amd-pstate.conf: No such file or directory

I know that commenting it out should have been enough, just wanted to make sure that the file simply being there with that name does not somehow trigger it to load it.

1 Like

Just upgraded my Kernel and AMD-Pstate is not enabled by default in zen3, maybe because shared_mem is not stable yet and zen4 doesn’t need it for CPPC…

you could try with only enabling shared_mem and not doing the enable pstate step. It should load pstate then

1 Like

You are right, I don’t need the module anymore, just the kernel option is enough.

$ cat /proc/cmdline 
initrd=\91192e68b46945dba4aad45cee594025\6.0.11-arch1-1\initrd root=UUID=87e2342f-eea1-4780-bd7a-65ebfc4c8aa1 rw rootflags=subvol=@ loglevel=3 nowatchdog nvme_load=YES amd_pstate.shared_mem=1 mitigations=auto,nosmt systemd.machine_id=91192e68b46945dba4aad45cee594025 systemd.machine_id=91192e68b46945dba4aad45cee594025

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

$ cat  /etc/modules-load.d/amd-pstate.conf
# Load amd pstate at boot
#amd_pstate
1 Like

epp v2 is coming

https://lore.kernel.org/linux-pm/20221207154648.233759-1-wyes.karny@amd.com/

2 Likes

For some reason that I could not yet figure out, with 6.1 AMD P-State can not be enabled anymore …

zless /proc/config.gz | grep AMD_PSTATE                
CONFIG_X86_AMD_PSTATE=y
CONFIG_X86_AMD_PSTATE_UT=m

UT means unit test, it was added with this version.
The file changes nothing:

cat /etc/modules-load.d/amd-pstate.conf
# Load amd pstate at boot
amd_pstate

When I do sudo modprobe -r acpi-cpufreq and sudo modprobe amd_pstate I end up with no scaling driver at all xD

Edit: Ok, now one needs amd-pstate=passive as boot parameter to enable it, even on Zen4 …

4 Likes

yes adding amd_pstate=passive will works

from
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=202e683df37cdf4c38e06e56ac91cc170ef49058

2 Likes

ok so ill add this to the OP that amd_pstate=passive may be necessary for 6.1

thanks @BS86 and @Stephane

Yes it’s working for me also. The only one that pstate doesn’t work on is my Ryzen 4700U. All my 5000 series cpu are fine. The 4700U is using acpi_cpufreq

Edit: Arch wiki is updated to show this also.