Trying to set CPU governor for Ryzen 2700 CPU

Okay, so I’ve read the ArchWiki instructions here (https://wiki.archlinux.org/index.php/CPU_frequency_scaling). It loves to talk about Intel CPUs. I know that Phoronix was able to set the CPU governor on Ryzen systems in 2017 using acpi-cpufreq here (https://www.phoronix.com/scan.php?page=article&item=amd-ryzen-cpufreq&num=1).

I need a step-by-step guide to help me here, I am losing my mind over this. I don’t need links to the ArchWiki, I need layman, copy/paste instructions because for the life of me I can’t figure this out. Stuff keeps erroring out when I try to use the ArchWiki, and I’m not sure where to go from here, so I’ll restart from scratch with your all’s input.

Previously, I had my system OC’d back when I had Windows 7 installed (a few years ago). I don’t think my CPU won the silicon lottery as I was able to OC in the BIOS at around 4.0 to 4.1 GHz at 1.40V. After switching to Ubuntu & then EndeavourOS, I noticed that both Linux distros would never be set at that 4.0 or 4.1 GHz when viewed by Conky or “cpupower frequency-info”, it would always vary from 3.3 to 3.8 GHz, which is why I tried to set the CPU governor again after previously failing. I have Superposition benchmarks on the ready for when I get this working to compare them to.

All help greatly appreciated, thank you.

To set governor:
sudo cpupower frequency-set -g name_of_governor
where name_of_governor is one of

powersave
performance
ondemand
schedutil
conservative
userspace

of which the two last ones are not very practical.

To set a governor by default on boot, edit /etc/default/cpupower.

1 Like

So is your issue that you want to set the governor, or that you think the CPU frequency is being displayed incorrectly?

(For new people trying to do this baby step by baby step) Your comment assumes that you installed cpupower (I did so through yay), and maybe some other steps as well. Can you break down the exact steps (if modprobe is needed, if restarts are needed, etc?).

So, I’ve done those steps, I’ve set the governor to both performance and userspace (where I edited the min freq to 3.8GHz and max freq to 4.0GHz) as separate tests and nothing changed (verified by conky and cpupower frequency-info). I can set the governor fine (cpupower frequency-set xyz and I even edited the /etc/default/cpupower file as well), but neither works.

I can give you the errors that pop up if you give me the steps you want me to try.

I don’t think cpupower is working at all, which is why it’s displaying the CPU frequency wrong when checked.

If you list out some steps for me, I can show you all the errors. Since I’m on a Ryzen system and Phoronix used acpi-cpufreq for his system, I noticed that when I used modprobe it couldn’t find that module for my kernel, even though this command listed it as well as others:

These are my exact steps:

yay thermald
sudo systemctl enable thermald
sudo systemctl start thermald
yay cpupower
sudo systemctl enable cpupower
sudo systemctl start cpupower
sudo ls /usr/lib/modules/$(uname -r)/kernel/drivers/cpufreq/

acpi-cpufreq.ko.xz
cpufreq_conservative.ko.xz
cpufreq_ondemand.ko.xz
cpufreq_userspace.ko.xz
pcc-cpufreq.ko.xz
speedstep-lib.ko.xz
amd_freq_sensitivity.ko.xz
cpufreq-dt.ko.xz
cpufreq_powersave.ko.xz
p4-clockmod.ko.xz
powernow-k8.ko.xz

(The performance governor didn’t show up???)

sudo modprobe acpi-cpufreq

modprobe: ERROR: could not insert ‘acpi_cpufreq’: No such device

sudo modprobe acpi-cpufreq.ko.xz

modprobe: FATAL: Module acpi-cpufreq.ko.xz not found in directory /lib/modules/5.8.5-arch1-1

sudo modprobe /usr/lib/modules/$(uname -r)/kernel/drivers/cpufreq/acpi-cpufreq

modprobe: FATAL: Module /usr/lib/modules/5.8.5-arch1-1/kernel/drivers/cpufreq/acpi-cpufreq not found in directory /lib/modules/5.8.5-arch1-1

sudo modprobe /usr/lib/modules/$(uname -r)/kernel/drivers/cpufreq/acpi-cpufreq.ko.xz

modprobe: FATAL: Module /usr/lib/modules/5.8.5-arch1-1/kernel/drivers/cpufreq/acpi-cpufreq.ko.xz not found in directory /lib/modules/5.8.5-arch1-1

sudo cpupower frequency-info

analyzing CPU 0:
no or unknown cpufreq driver is active on this CPU
CPUs which run at the same hardware frequency: Not Available
CPUs which need to have their frequency coordinated by software: Not Available
maximum transition latency: Cannot determine or is not supported.
Not Available
available cpufreq governors: Not Available
Unable to determine current policy
current CPU frequency: Unable to call hardware
current CPU frequency: Unable to call to kernel
boost state support:
Supported: yes
Active: yes
Boost States: 0
Total States: 3
Pstate-P0: 4000MHz
Pstate-P1: 4000MHz
Pstate-P2: 1550MHz

sudo nano /etc/default/cpupower
(uncomment & set governor=‘performance’)

(reboot)

I’m a bit curious as to why you would want this (I’m on a couple of Ryzens too). My understanding of the way the Ryzens OC is that they boost the clocks on cores separately as needed - and setting a higher ‘constant’ value actually leads to slower performance if not constantly under high loads. As, for instance, it can shift up to 4.4 (example) under load, while running at 3.6 - but can only be pushed to 4.1 as a constant. I’m no processor guru though… :grin: (not to mention I don’t work mine hard at all - with the exception of compiling)

Just learning as I go…

This is mostly a gaming computer, but I do other things like run VMs too.

Two reasons:

(1) I OC’d the CPU to 4.0GHz in the BIOS, but both conky & cpupower report that my CPU cores vary between the 3.2 to 3.9 GHz range instead of at a constant 4.0 GHz. This is not a BIOS issue but rather something within Linux doing this. I have a CryoRig cooler on it so I’m not worried about temps, but I do know that when I OC’d my FX-series CPU to 4.0GHz, all cores stayed at a constant 4.0GHz, so I’m assuming that’s what’s supposed to happen here as well.

(2) Phoronix was able to get a little more performance out of his Ryzen (1800) system, so I’d like to do the same.

I wonder if somehow it is getting set to “Precision Boost Overdrive” instead of taking on board your “manual” settings? I can’t see how it could override the BIOS, though… What are you feeding it for voltage? Perhaps it is a bit short, and internally overrides?

Personally - I just push the RAM, and let the multi-cores do their own thing most of the time :grin:

Good luck - and I’ll mention that I’ve never seen conky report anything close to a steady state in ${freq_g} on mine

Weird, the acpi-cpufreq module should be available?
Arch kernel config has CONFIG_X86_ACPI_CPUFREQ=m

$ find /usr/lib/modules/5.8.7-arch1-1 -name "acpi-cpufreq*"                                                                                                                                                              
/usr/lib/modules/5.8.7-arch1-1/kernel/drivers/cpufreq/acpi-cpufreq.ko.xz

Can you upgrade/reinstall your Arch kernel again?
And do you have any additional non-default kernel boot parameters?

Oh, you’re running 5.8.5 - did you upgrade your kernel without rebooting? We’re at 5.8.7 now.
And try disabling thermald, I don’t think you need that?

1 Like

I don’t think PBO is set, I’ll check the BIOS unless there’s some Linux setting I need to check as well.

I can upgrade my kernel again, but I don’t think it was available in previous kernels (for me at least). I did reboot/shutdown every time. I don’t have any non-standard boot parameters. I will uninstall thermald as well.

I am trying to lower my laptop power consumption.

On 'tips" in EOS welcome, it says one option is to load the powersave kernel module. I am following those directions. I am unable to modprobe cpufreq_powersave.ko.xz, since it says FATAL, unable to find module in directory /lib/modules/5.9.2-arch1-1

The module is in a subdirectory of above dir.

Thanks

UPDATE: No worries, I figured it out that you have to use modprobe w/o the .ko.xz extension of the file, ie w/ just module name.

2 Likes

Does your laptop have a Ryzen 2700 ? :thinking: