Weird CPU governor issues

So I’ve been dealing with an issue for about a year now, and every time I try to fix it either it doesn’t work or I break my install (fail to boot, incorrect grub configuration) trying to implement a fix.
The problem is with the CPU governor is constantly being locked in “power saver” mode the cpu will not budge beyond 2.2+ Ghz (idle) without manually setting it to “performance” or “ondemand” through cpupower/cpupower-gui. If left unchanged the computer will struggle to do anything such as taking a long time to load a browser or open basic programs. The problems then intensify when hit with any sort of load, sometimes soft locking.

I’ve modified /etc/default/cpupower setting "governor=‘ondemand’ " recently
I’ve also looked at grub and couldn’t find “amd_pstate” when i searched the grub

One solution I was going to try was to load a bash script on startup however it would require administrative privileges causing it to do nothing on startup. this is also just a band-aid fix for the issue.

My system is thus:

CPU: Ryzen 2700X (default OC) (8c 16t ~3.7Ghz)
MB: MSI 570-A Pro (MS-7C37)
RAM: G.Skill 2x8GB DDR4 3200 Mhz
GPU: Nvidia RTX 2070 Super
OS: EndeavourOS (Latest update)
Kernel: Linux 6.6.44-3-lts/default Linux Kernel
Graphics: X11 (wayland doesn’t work atm)
OS Installed on SSD, no swap

GRUB config:


GRUB boot loader configuration

GRUB_DEFAULT=‘0’
GRUB_TIMEOUT=‘5’
GRUB_DISTRIBUTOR=‘EndeavourOS’
GRUB_CMDLINE_LINUX_DEFAULT=‘nowatchdog nvme_load=YES rd.luks.uuid=e8b539f2-9bfa-4acb-b054-1ab3cae54dd0 loglevel=3’
GRUB_CMDLINE_LINUX=“”

Preload both GPT and MBR modules so that they are not missed

GRUB_PRELOAD_MODULES=“part_gpt part_msdos”

Uncomment to enable booting from LUKS encrypted devices

GRUB_ENABLE_CRYPTODISK=y

Set to ‘countdown’ or ‘hidden’ to change timeout behavior,

press ESC key to display menu.

GRUB_TIMEOUT_STYLE=menu

Uncomment to use basic console

GRUB_TERMINAL_INPUT=console

Uncomment to disable graphical terminal

#GRUB_TERMINAL_OUTPUT=console

The resolution used on graphical terminal

note that you can use only modes which your graphic card supports via VBE

you can see them in real GRUB with the command `videoinfo’

GRUB_GFXMODE=auto

Uncomment to allow the kernel use the same resolution used by grub

GRUB_GFXPAYLOAD_LINUX=keep

Uncomment if you want GRUB to pass to the Linux kernel the old parameter

format “root=/dev/xxx” instead of “root=/dev/disk/by-uuid/xxx”

#GRUB_DISABLE_LINUX_UUID=true

Uncomment to disable generation of recovery mode menu entries

GRUB_DISABLE_RECOVERY=‘true’

Uncomment and set to the desired menu colors. Used by normal and wallpaper

modes only. Entries specified as foreground/background.

#GRUB_COLOR_NORMAL=“light-blue/black”
#GRUB_COLOR_HIGHLIGHT=“light-cyan/blue”

Uncomment one of them for the gfx desired, a image background or a gfxtheme

GRUB_BACKGROUND=‘/usr/share/endeavouros/splash.png’
#GRUB_THEME=“/path/to/gfxtheme”

Uncomment to get a beep at GRUB start

#GRUB_INIT_TUNE=“480 440 1”

Uncomment to make GRUB remember the last selection. This requires

setting ‘GRUB_DEFAULT=saved’ above.

#GRUB_SAVEDEFAULT=true

Uncomment to disable submenus in boot menu

GRUB_DISABLE_SUBMENU=‘false’

Probing for other operating systems is disabled for security reasons. Read

documentation on GRUB_DISABLE_OS_PROBER, if still want to enable this

functionality install os-prober and uncomment to detect and include other

operating systems.

#GRUB_DISABLE_OS_PROBER=false
GRUB_EARLY_INITRD_LINUX_STOCK=‘’


CPUPOWER


Define CPUs governor

valid governors: ondemand, performance, powersave, conservative, userspace.

governor=‘ondemand’

Limit frequency range

Valid suffixes: Hz, kHz (default), MHz, GHz, THz

#min_freq=“2.25GHz”
#max_freq=“3GHz”

Specific frequency to be set.

Requires userspace governor to be available.

Do not set governor field if you use this one.

#freq=

Utilizes cores in one processor package/socket first before processes are

scheduled to other processor packages/sockets.

See man (1) CPUPOWER-SET for additional details.

#mc_scheduler=

Utilizes thread siblings of one processor core first before processes are

scheduled to other cores. See man (1) CPUPOWER-SET for additional details.

#smp_scheduler=

Sets a register on supported Intel processore which allows software to convey

its policy for the relative importance of performance versus energy savings to

the processor. See man (1) CPUPOWER-SET for additional details.

#perf_bias=

vim:set ts=2 sw=2 ft=sh et:


Thanks in advance for taking the time to help.

After a reboot, what say the following commands:

cpupower frequency-info 
systemctl status cpupower.service

?

cpupower frequency-info

analyzing CPU 12:
driver: acpi-cpufreq
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: 2.20 GHz - 3.70 GHz
available frequency steps: 3.70 GHz, 3.20 GHz, 2.20 GHz
available cpufreq governors: conservative ondemand userspace powersave performance schedutil
current policy: frequency should be within 2.20 GHz and 3.70 GHz.
The governor “powersave” may decide which speed to use
within this range.
current CPU frequency: Unable to call hardware
current CPU frequency: 2.20 GHz (asserted by call to kernel)
boost state support:
Supported: yes

systemctl status cpupower.service

● cpupower.service - Apply cpupower configuration
Loaded: loaded (/usr/lib/systemd/system/cpupower.service; enabled; preset: disabled)
Active: active (exited) since Fri 2024-08-09 15:40:25 CDT; 32s ago
Invocation: b6af7e9cfa77437f9a1dc70ca00e77e9
Process: 982 ExecStart=/usr/lib/systemd/scripts/cpupower (code=exited, status=0/SUCCESS)
Main PID: 982 (code=exited, status=0/SUCCESS)
Mem peak: 1.9M
CPU: 14ms

Aug 09 15:40:24 ******** systemd[1]: Starting Apply cpupower configuration…
Aug 09 15:40:25 ******** systemd[1]: Finished Apply cpupower configuration.

I don’t think amd_pstate will work with the Ryzen 2700X
amd_pstate is only supported on chips with zen2

Edit:

https://wiki.archlinux.org/title/CPU_frequency_scaling#Scaling_drivers

that makes sense, didn’t realize that was a Zen2+ feature, but how come I can’t set the governor to something permanently. The issue is it reverts on reboot and it’s kind of tedious to manually set it every time. It would be so much simpler if I could just automate it with a script or something but that’s not really an option due to admin privs being needed. typically I would just roll up my sleeves and work out the bug myself but this has truly stumped me. I don’t understand why it reverts to the most minimal possible governor. I did see something that said that some processors that don’t have ondemand, scheduledutil, conservative, ect when set to such will just revert to the minimal governor instead of performance out of the two options. However my CPU shows all that, and setting it to performance has no effect on permanency. In the end it’s not a major issue but it is a bit tedious. this issue doesn’t seem to be present outside of arch based systems either, though I really like Arch and Endeavour in particular and have no intention of switching to fix one bug, it’s just worth noting.

I have an MSI X570 Gaming Plus with a Ryzen 3800X. I am using amd_pstates=passive. I also set my motherboard settings to use 65W rather than 100w.

[ricklinux@rick-ms7c37 ~]$ systemctl status cpupower.service
● cpupower.service - Apply cpupower configuration
     Loaded: loaded (/usr/lib/systemd/system/cpupower.service; disabled; preset: disabled)
     Active: active (exited) since Fri 2024-08-09 22:13:50 EDT; 5min ago
 Invocation: 0dedb1c26c4f45dea782aa142cf74477
    Process: 17577 ExecStart=/usr/lib/systemd/scripts/cpupower (code=exited, status=0/SUCCESS)
   Main PID: 17577 (code=exited, status=0/SUCCESS)
   Mem peak: 1.7M
        CPU: 15ms

Aug 09 22:13:50 rick-ms7c37 systemd[1]: Starting Apply cpupower configuration...
Aug 09 22:13:50 rick-ms7c37 systemd[1]: Finished Apply cpupower configuration.
[ricklinux@rick-ms7c37 ~]$ 
[ricklinux@rick-ms7c37 ~]$ cpupower frequency-info 
analyzing CPU 4:
  driver: amd-pstate
  CPUs which run at the same hardware frequency: 4
  CPUs which need to have their frequency coordinated by software: 4
  maximum transition latency: 4.00 ms
  hardware limits: 550 MHz - 4.56 GHz
  available cpufreq governors: conservative ondemand userspace powersave performance schedutil
  current policy: frequency should be within 550 MHz and 4.56 GHz.
                  The governor "schedutil" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 1.49 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    AMD PSTATE Highest Performance: 166. Maximum Frequency: 4.56 GHz.
    AMD PSTATE Nominal Performance: 142. Nominal Frequency: 3.90 GHz.
    AMD PSTATE Lowest Non-linear Performance: 64. Lowest Non-linear Frequency: 1.76 GHz.
    AMD PSTATE Lowest Performance: 21. Lowest Frequency: 550 MHz.
[ricklinux@rick-ms7c37 ~]$ 

cpupower is set to ondemand

I followed the steps described here Cpupower doesn't set governor on boot - #4 by pebcak to set the governor I wanted at boot. Make sure to use the correct commands because in the discussion is said that there was a typo in one of the commands provided. Since you already modified your /etc/default/cpupower setting it is worth to check if you disabled the power-profiles-daemon… Hope it will help you :slightly_smiling_face:

2 Likes

That’s something I haven’t thought of before, so I ran the commands. everything appears to be running; Still I’ll post the results in case I missed something.

I did a fresh reboot to ensure: A) my profiles weren’t active. B) There’s nothing changed.
I tried restarting the services after checking status’s I’ve posted and suddenly the governor is set to “ondemand” now I just need to figure out how to get it to start up properly every time without restarting the service (still requires admin privs which means no scripts).

systemctl status power-profiles-daemon

● power-profiles-daemon.service - Power Profiles daemon
Loaded: loaded (/usr/lib/systemd/system/power-profiles-daemon.service; enabled; preset: disabled)
Active: active (running) since Sat 2024-08-10 14:44:57 CDT; 45s ago
Invocation: 8e8a06e0c03f479cb375629d1587d198
Main PID: 989 (power-profiles-)
Tasks: 4 (limit: 18961)
Memory: 3.4M (peak: 4.3M)
CPU: 43ms
CGroup: /system.slice/power-profiles-daemon.service
└─989 /usr/lib/power-profiles-daemon

Aug 10 14:44:56 ******** systemd[1]: Starting Power Profiles daemon…
Aug 10 14:44:57 ******** systemd[1]: Started Power Profiles daemon.

systemctl status cpupower

● cpupower.service - Apply cpupower configuration
Loaded: loaded (/usr/lib/systemd/system/cpupower.service; enabled; preset: disabled)
Active: active (exited) since Sat 2024-08-10 14:44:57 CDT; 57s ago
Invocation: bd4824ca94ba416aa2f9a1bbf825285a
Process: 985 ExecStart=/usr/lib/systemd/scripts/cpupower (code=exited, status=0/SUCCESS)
Main PID: 985 (code=exited, status=0/SUCCESS)
Mem peak: 1.7M
CPU: 11ms

Aug 10 14:44:56 ******** systemd[1]: Starting Apply cpupower configuration…
Aug 10 14:44:57 ******** systemd[1]: Finished Apply cpupower configuration.

sudo cpupower frequency-info

analyzing CPU 14:
driver: acpi-cpufreq
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: 2.20 GHz - 3.70 GHz
available frequency steps: 3.70 GHz, 3.20 GHz, 2.20 GHz
available cpufreq governors: conservative ondemand userspace powersave performance schedutil
current policy: frequency should be within 2.20 GHz and 3.70 GHz.
The governor “powersave” may decide which speed to use
within this range.
current CPU frequency: 2.20 GHz (asserted by call to hardware)
boost state support:
Supported: yes
Active: yes
Boost States: 0
Total States: 3
Pstate-P0: 3700MHz
Pstate-P1: 3200MHz
Pstate-P2: 2200MHz

---------restarting services--------------------

systemctl restart power-profiles-daemon

systemctl restart cpupower

systemctl status power-profiles-daemon

● power-profiles-daemon.service - Power Profiles daemon
Loaded: loaded (/usr/lib/systemd/system/power-profiles-daemon.service; enabled; preset: disabled)
Active: active (running) since Sat 2024-08-10 14:58:42 CDT; 27s ago
Invocation: a3ab5819e9c54295bed386ef842e8676
Main PID: 3231 (power-profiles-)
Tasks: 4 (limit: 18961)
Memory: 3.1M (peak: 3.9M)
CPU: 65ms
CGroup: /system.slice/power-profiles-daemon.service
└─3231 /usr/lib/power-profiles-daemon

Aug 10 14:58:42 ******** systemd[1]: Starting Power Profiles daemon…
Aug 10 14:58:42 ******** systemd[1]: Started Power Profiles daemon.

systemctl status cpupower

● cpupower.service - Apply cpupower configuration
Loaded: loaded (/usr/lib/systemd/system/cpupower.service; enabled; preset: disabled)
Active: active (exited) since Sat 2024-08-10 14:58:57 CDT; 21s ago
Invocation: 40e999ded87d4776825887aa219d9a44
Process: 3291 ExecStart=/usr/lib/systemd/scripts/cpupower (code=exited, status=0/SUCCESS)
Main PID: 3291 (code=exited, status=0/SUCCESS)
Mem peak: 1.8M
CPU: 12ms

Aug 10 14:58:56 ******** systemd[1]: Stopped Apply cpupower configuration.
Aug 10 14:58:56 ******** systemd[1]: Stopping Apply cpupower configuration…
Aug 10 14:58:56 ******** systemd[1]: Starting Apply cpupower configuration…
Aug 10 14:58:57 ******** systemd[1]: Finished Apply cpupower configuration.

sudo cpupower frequency-info

analyzing CPU 7:
driver: acpi-cpufreq
CPUs which run at the same hardware frequency: 7
CPUs which need to have their frequency coordinated by software: 7
maximum transition latency: Cannot determine or is not supported.
hardware limits: 2.20 GHz - 3.70 GHz
available frequency steps: 3.70 GHz, 3.20 GHz, 2.20 GHz
available cpufreq governors: conservative ondemand userspace powersave performance schedutil
current policy: frequency should be within 2.20 GHz and 3.70 GHz.
The governor “ondemand” may decide which speed to use
within this range.
current CPU frequency: 2.20 GHz (asserted by call to hardware)
boost state support:
Supported: yes
Active: yes
Boost States: 0
Total States: 3
Pstate-P0: 3700MHz
Pstate-P1: 3200MHz
Pstate-P2: 2200MHz

Great thinking @General_Kenobi & @pebcak the solution is pretty close I’m just unsure how to get the service to launch correctly on startup.

You would need to stop, disable and mask the other one if you are going to use cpupower.service.

so do I disable acpi-cpufreq or power-profiles-daemon or both?

Only this ^

sudo systemctl disable --now power-profiles-daemon

sudo systemctl mask power-profiles-daemon

Now when you reboot, cpupower.service will apply the values you have set in
/etc/default/cpupower.

1 Like

sudo cpupower frequency-info

analyzing CPU 4:
driver: acpi-cpufreq
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: 2.20 GHz - 3.70 GHz
available frequency steps: 3.70 GHz, 3.20 GHz, 2.20 GHz
available cpufreq governors: conservative ondemand userspace powersave performance schedutil
current policy: frequency should be within 2.20 GHz and 3.70 GHz.
The governor “powersave” may decide which speed to use
within this range.
current CPU frequency: 2.20 GHz (asserted by call to hardware)
boost state support:
Supported: yes
Active: yes
Boost States: 0
Total States: 3
Pstate-P0: 3700MHz
Pstate-P1: 3200MHz
Pstate-P2: 2200MHz

systemctl status power-profiles-daemon

○ power-profiles-daemon.service
Loaded: masked (Reason: Unit power-profiles-daemon.service is masked.)
Active: inactive (dead)

It didn’t work… :disappointed:

Then it beats me. I don’t know what the issue may be. Perhaps some other forum members will be able to figure it out :thinking:

Thanks for the help, I appreciate it. We’ve managed to narrow it down to a service issue since restarting cpupower.service somehow applies the governor profile. You’ve been a great help.

1 Like

bump

Is cpupower service enabled?
sudo systemctl enable --now cpupower.service

have you checked option in UEFI motherboard ?
you should have cppc on / auto for amd-pstate
see this

@pebkab , may be it required shared memory

1 Like

Yes it’s been enabled I doubled checked just to make sure but it shows in systemctl status cpupower it’ll have a ● next to cpupower.service

the 2700X is a Zen+ architecture apparently it doesn’t have pstate according to another poster though it does show “Pstates” frequently in the cpu information (I did a check with BIOS though and I didn’t see any options)

lscpu

Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 43 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: AuthenticAMD
Model name: AMD Ryzen 7 2700X Eight-Core Processor
CPU family: 23
Model: 8
Thread(s) per core: 2
Core(s) per socket: 8
Socket(s): 1
Stepping: 2
Frequency boost: enabled
CPU(s) scaling MHz: 89%
CPU max MHz: 3700.0000
CPU min MHz: 2200.0000
BogoMIPS: 7400.23
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx
mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni p
clmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm exta
pic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext per
fctr_llc mwaitx cpb hw_pstate ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni x
saveopt xsavec xgetbv1 clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasi
d decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca sev sev_es
Virtualization features:
Virtualization: AMD-V
Caches (sum of all):
L1d: 256 KiB (8 instances)
L1i: 512 KiB (8 instances)
L2: 4 MiB (8 instances)
L3: 16 MiB (2 instances)
NUMA:
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerabilities:
Gather data sampling: Not affected
Itlb multihit: Not affected
L1tf: Not affected
Mds: Not affected
Meltdown: Not affected
Mmio stale data: Not affected
Reg file data sampling: Not affected
Retbleed: Mitigation; untrained return thunk; SMT vulnerable
Spec rstack overflow: Mitigation; Safe RET
Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Spectre v2: Mitigation; Retpolines; IBPB conditional; STIBP disabled; RSB filling; PBRSB-eIBRS Not affected; BHI Not affecte
d
Srbds: Not affected
Tsx async abort: Not affected

don’t see any references to cppc