How to enable amd-pstate?

how to enable amd pstate in kernel(5.15.71-1-MANJARO)

Is it even available for that kernel?
I don’t think so.

check:
zcat /proc/config.gz | grep PSTATE
if this:
CONFIG_X86_AMD_PSTATE=...
is not among the results - it isn’t available.
On newer kernels it is.

kernrs >5.17, for manjaro this means

  • linux519 5.19.13
  • linux60 6.0.0rc7

I am trying to get this going myself, but I am also trying to avoid rendering my machine un-bootable.

I can see that AMD PState can be loaded on my kernel (6.0), and I even ran the zcat command to confirm it. Cool. I have upgraded my BIOS and force CPPC support to Enabled. Even cooler.

acpi-cpufreq is loaded by default rather than as a module. So that means blocking it.

My question is: is there a definitive list of CPUs supported by the Pstate driver? Every page I read says that support for Zen3 and Zen4 was included from day 1, but they say that Zen 2 support will come/came at a later date.

The kernel.org documentation says:
" Currently, amd-pstate supports basic frequency control function according to kernel governors on some of the Zen2 and Zen3 processors, and we will implement more AMD specific functions in future after we verify them on the hardware and SBIOS"
amd-pstate CPU Performance Scaling Driver — The Linux Kernel documentation

EDIT:

Trying to follow Phoronix’s guide from here:

And it says:
" To avoid loading ACPI CPUFreq even if it’s built-in, the “initcall_blacklist=acpi_cpufreq_init” option can be set in your /boot/grub/grub.cfg or respective place for editing your kernel command line options at boot (e.g. “/etc/default/grub” for a more permanent solution)"

It seems that Manjaro really doesn’t want me editing the /boot/grub/grub.cfg file, so I go and edit /etc/default/grub, but I am not 100% sure what it’s telling me to do. I assume I am supposed to edit the GRUB_CMDLINE_LINUX_DEFAULT entry and insert “initcall_blacklist=acpi_cpufreq_init”?

EDIT 2:

Also, for loading modules it seems things are different on Manjaro?

To get the amd_pstate module to load at boot I suppose I need to add a line to /etc/modules-load.d/amd_pstate.conf?

something like:

# Load amd_pstate.ko at boot
amd_pstate

EDIT 3:

OK, so I reboot after creating the module file and run:
journalctl -b 0 | grep pstate

And get:

Oct 14 16:57:02 telperion kernel: amd_pstate: This processor supports shared memory solution, you can enable it with amd_pstate.shar
ed_mem=1
Oct 14 16:57:02 telperion systemd-modules-load[384]: Failed to insert module 'amd_pstate': No such device

OK, getting close now…

So I edit:
/etc/default/grub:

and add amd_pstate.shared_mem=1 to the GRUB_CMDLINE_LINUX_DEFAULT entry.

I run sudo grub-mkconfig -o /boot/grub/grub.cfg to apply the change and then reboot.

All solved!

So far, I have loaded the amd_pstate driver on five machines, one 3700, two 4500Us and two 5000 series CPUs, and the only one that has needed the shared_mem work-around was the 3700.

I added amd_pstate.shared_mem=1 to my /etc/default/grub config, and I think that’s all.
I also added the module to /etc/mkinitcpio.conf file MODULES=(amd_pstate) so it is included in images.

I just updated my post above with the procedure I found that worked.

It doesn’t need to be baked into initcpio, putting a file into /etc/modules-load.d is all that’s been required on most of my machines.

What surprised me most was that nearly all the instructions I have found claim you need to blacklist the acpi-cpufreq module, and it just doesn’t seem to be the case.

As far as I can tell, only Zen 2 CPUs need the shared_mem workaround.

I have written these instructions:

Step 1 - Set kernel module to load
sudo bash -c "echo 'amd_pstate' > /etc/modules-load.d/amd_pstate.conf"

Reboot
Enter BIOS
Enable CPPC option if disabled.

Step 2 - check result
journalctl -b 0 | grep pstate

If the response is:
“kernel: amd_pstate: This processor supports shared memory solution, you can enable it with amd_pstate.shared_mem=1“
Progress to Step 3.

If the response is:
systemd-modules-load[374]: Inserted module 'amd_pstate'

Then run:
cpupower frequency-info

If you see:
driver: amd-pstate
The job is done!

Step 3 -
Edit /etc/default/grub

Insert “amd_pstate.shared_mem=1” into the GRUB_CMDLINE_LINUX_DEFAULT

Run
sudo grub-mkconfig -o /boot/grub/grub.cfg

Reboot

Re-run checks from Step 2.

Maybe that was the case at some point in time.

Interesting topic !

Did you see any improvement compared to cpufreq ? Especially for the 3700 one ?

Basically it allows, on my side, to hit low CPU frequency when idle (500MHz), and I get higher clock (the actual supposed boost frequency of 4.2GHz). Maybe it does manage power more efficiently too.

Unless you do real extensive proper tests and benchmarks, multiple time, nobody know the benefit you may have. I just prefer to use the AMD P-State module but I don’t think you gain anything in real life scenario.

Hi,

thanks for the description, it helped me greatly; However I had to also add amd_pstate=passive before the initcall_blacklist... inside the default grub configuration and now it is working as intended on my Ryzen 5700U processor with 6.1.21-1-MANJARO kernel installed.

The step was found here: https://forum.proxmox.com/threads/amd-pstate-driver-steps-and-discussion.118873/