How to use AMD P-State in Linux

I have cpu power set to ondemand?

That shouldn’t be possible if you are using amd-pstate-epp active.

Check if cpupower is running by typing:
Obs: the output below is using amd-pstate-epp active mode in kernel cmdline, using the default governor powersave.

cpupower frequency-info
analyzing CPU 14:
  driver: amd-pstate-epp
  CPUs which run at the same hardware frequency: 14
  CPUs which need to have their frequency coordinated by software: 14
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 550 MHz - 4.55 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 550 MHz and 4.55 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 550 MHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: no
systemctl status cpupower.service
● cpupower.service - Apply cpupower configuration
     Loaded: loaded (/usr/lib/systemd/system/cpupower.service; enabled; preset: disabled)
     Active: active (exited) since Wed 2023-07-26 11:23:02 -03; 1h 44min ago
   Main PID: 3623 (code=exited, status=0/SUCCESS)
        CPU: 1ms

jul 26 11:23:02 eos systemd[1]: Starting Apply cpupower configuration...
jul 26 11:23:02 eos systemd[1]: Finished Apply cpupower configuration.
[ricklinux@eos-plasma ~]$ cpupower frequency-info
analyzing CPU 12:
  driver: amd-pstate-epp
  CPUs which run at the same hardware frequency: 12
  CPUs which need to have their frequency coordinated by software: 12
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 550 MHz - 4.56 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 550 MHz and 4.56 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 550 MHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: no
[ricklinux@eos-plasma ~]$ systemctl status cpupower.service
● cpupower.service - Apply cpupower configuration
     Loaded: loaded (/usr/lib/systemd/system/cpupower.service; enabled; preset: disabled)
     Active: active (exited) since Wed 2023-07-26 11:49:17 EDT; 22min ago
    Process: 537 ExecStart=/usr/lib/systemd/scripts/cpupower (code=exited, status=0/SUCCESS)
   Main PID: 537 (code=exited, status=0/SUCCESS)
        CPU: 2ms

Jul 26 11:49:17 eos-plasma systemd[1]: Starting Apply cpupower configuration...
Jul 26 11:49:17 eos-plasma systemd[1]: Finished Apply cpupower configuration.
[ricklinux@eos-plasma ~]$ 

Edit: I guess it’s correct?

You are using amd-pstate-epp, active mode | governor powersave… So, you are not using ondemand.

Okay i see in the /etc/default/cpupower.conf it is commented out!

Exactly, it defaults to powersave..
If you set ondemand in that file, cpupower won’t run because ondemand is not a valid governor for amd-pstate-epp driver.

Edit:
In the other hand, if you set the driver to amd-pstate=guided, you won’t be using amd-pstate-epp driver anymore, you will be using amd-pstate and you will be able to use ondemand,schedutil… governors.

1 Like

Do you mean if i use the that kernel parameter and then set ondemand in cpupower by uncommenting it?

Yes, that is correct.
Change your kernel cmdline to amd-pstate=guided and uncomment #ondemand in that cpupower file and you will be using ondemand governor without any problems..

I wonder if it is better?

I’ve been using guided mode with schedutil governor for a few weeks, worked just fine.
Now I’m using active mode with powersave governor to see if I can confirm if my cooler RPMs are indeed lower than before as you mentioned previously..
I didn’t test ondemand with amd-pstate=guided option..

Let me know what you think then. :wink:

1 Like

I’ll, so far, so good :slight_smile:

What is not clear to me about all that has been discussed above, is that balanced_performance governor, I can’t find it anywhere… It has been mentioned a few times in the phonorix articles..

“balance_performance” is not a governor it is an “energy performance preference”.

It is only available in “active” mode. You can check it (with “active” mode enabled):

cat /sys/devices/system/cpu/cpu*/cpufreq/energy_performance_preference
cat /sys/devices/system/cpu/cpu*/cpufreq/energy_performance_available_preferences

One way to change this is through “power-profiles-daemon”. E.g on KDE Plasma you can change it via the power management icon in the system tray (if “power-profiles-daemon” is installed and “active” mode is enabled).

More info about all this stuff: https://www.kernel.org/doc/html/v6.4/admin-guide/pm/amd-pstate.html

1 Like

Hmm, nice info HBR.
For me, this is what was missing in the puzzle…

image

$ cat /sys/devices/system/cpu/cpu*/cpufreq/energy_performance_preference
balance_performance

If I change that option in the picture to performance, I get:

$ cat /sys/devices/system/cpu/cpu*/cpufreq/energy_performance_preference
performance

And, if I change that setting to “Economia de energia” (power save in English), I get:

$ cat /sys/devices/system/cpu/cpu*/cpufreq/energy_performance_preference
power

Edit: “Desempenho” means performance in English.

1 Like

Yes i get this. I tried this before and i have mine set to balance_performance.

2 Likes

I’m trying the powersave mode (power).
It is actually very good…

I wish I had a laptop to test battery consumption… In a desktop this is not easy to test unfortunately…

1 Like

Good to see you two bashing this. I have the topic saved so I can come back to it when I have a little more time and try out a few things, so thanks.

1 Like

Nice, you will be able to enable or disable turbo-boost and change the amd-pstate through cpupower.

1 Like

On my system it doesn’t show boost state support? Do i need to change a setting in the Bios for this or am i missing something? Had to reinstall because of some testing and i wiped out my main drive with Kde. Oops! :rofl:

[ricklinux@eos-kde ~]$ cpupower frequency-info
analyzing CPU 4:
  driver: amd-pstate-epp
  CPUs which run at the same hardware frequency: 4
  CPUs which need to have their frequency coordinated by software: 4
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 550 MHz - 4.56 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 550 MHz and 4.56 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 3.85 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: no
[ricklinux@eos-kde ~]$ 
1 Like

My turbo boost also shows Active: no
Strange, because it is enabled in BIOS, not sure if cpupower is wrong or if it is disabled indeed.

If I check through conky, it seems to be enabled, I can reach boost frequencies.
However, checking with the command below, the MAX I can get is 3600MHz..

watch -n1 “grep "[1]pu MHz" /proc/cpuinfo”


  1. c ↩︎