AMD CPU and powersaving options

Just changed to this powerhouse of a beast:

CPU:
    model: AMD Ryzen 9 5900X bits: 64 type: MT MCP arch: Zen 3 gen: 4
    built: 2021-22 process: TSMC n7 (7nm) family: 0x19 (25) model-id: 0x21 (33)
    stepping: 0 microcode: 0xA201016
    Topology: cpus: 1x cores: 12 tpc: 2 threads: 24 smt: enabled cache:
    L1: 768 KiB desc: d-12x32 KiB; i-12x32 KiB L2: 6 MiB desc: 12x512 KiB
    L3: 64 MiB desc: 2x32 MiB
    Speed (MHz): avg: 2614 high: 3741 min/max: 550/4951 boost: enabled
    scaling: driver: amd-pstate governor: schedutil  
    bogomips: 177327
    Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm

Per default EndeavourOS using power-profiles-daemon what will not work on AMD CPU all together.

After setting amd-pstate to be used after reading this awsome thread:

i got it to show and let me set all possible frequencies my CPU support:

cpupower frequency-info               
analyzing CPU 0:
  driver: amd-pstate
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 131 us
  hardware limits: 550 MHz - 4.95 GHz
  available cpufreq governors: performance schedutil
  current policy: frequency should be within 550 MHz and 4.95 GHz.
                  The governor "schedutil" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 2.93 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    AMD PSTATE Highest Performance: 166. Maximum Frequency: 4.95 GHz.
    AMD PSTATE Nominal Performance: 124. Nominal Frequency: 3.70 GHz.
    AMD PSTATE Lowest Non-linear Performance: 58. Lowest Non-linear Frequency: 1.73 GHz.
    AMD PSTATE Lowest Performance: 19. Lowest Frequency: 550 MHz.

Without amd_pstate enabled it was only able to switch between 3 frequencies 2,4GHz 3,3GHz and 4,95GHz

First tool i was thinking of to control power modes was TLP and it somehow do work fine after some setup you can do with tlpui-git

2022-07-03_18-05
I do set in min and max freqs for my CPU according to the output from cpupower frequency-info
and it now is able to lower the frequencies down to 550MHz and up to full speeds depending on my usage.

Fans are way more silent and driving under 1000RPM now CPU temperature is on 45°C in normal Desktop usage before i had around 64°C.

And if this is not enough i can force to the lowest freq also with:
sudo cpupower frequency-set -u 550

amdryzen-speeds-2022-07-03_18.11.23

As someone never used AMD CPU i am somehow now in the position to see what we will need to have the same functionality as with intel CPUs and power-profiles-daemon, but i am not sure if it will be easy to get something implemented per default.

Asn some questions are open… is it always needed to force using amd-pstate and what is about other AMD CPUs do they have frequency scaling work out of the box?

So if you are using AMD CPU please share your findings and info on what you are using and what is offered by your CPU.
I do currently also running on linux-amd

Also available prebuilded if you mind building it … can take some time also if you have 12 Cores on 4.94 GHz…

[linuxkernels]
Server = http://nhameh.ovh/$repo/$arch
SigLevel = Optional TrustAll

I’m envious.

1 Like

@joekamprad
This is my output on the Ryzen 3800X

[ricklinux@rick-ms7c37 ~]$ sudo cpupower frequency-info 
[sudo] password for ricklinux: 
analyzing CPU 0:
  driver: amd-pstate
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 131 us
  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.64 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 ~]$ 

Edit: Seems very similar. But, this is a desktop.

mine is a Desktop too its slimshady:
IMG_20220703_185400879_HDR

but you see your Mainboard/CPU offers all frequencies per default…

Aside from the cpupower output other ones are interesting too:

to check default set scaling driver:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver
advanced CPU info:
inxi -Ca
also interesting is the output of sensors:
sensors | eos-sendlog

I can change the UEFI Bios settings from all core to per core?

[ricklinux@rick-ms7c37 ~]$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver
amd-pstate
[ricklinux@rick-ms7c37 ~]$ 
[ricklinux@rick-ms7c37 ~]$ inxi -Ca
CPU:
  Info: model: AMD Ryzen 7 3800X bits: 64 type: MT MCP arch: Zen 2 gen: 3
    built: 2020-22 process: TSMC n7 (7nm) family: 0x17 (23)
    model-id: 0x71 (113) stepping: 0 microcode: 0x8701021
  Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache:
    L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 4 MiB desc: 8x512 KiB
    L3: 32 MiB desc: 2x16 MiB
  Speed (MHz): avg: 2767 high: 3875 min/max: 550/4560 boost: enabled
    scaling: driver: amd-pstate governor: schedutil cores: 1: 1933 2: 2300
    3: 3515 4: 1943 5: 2459 6: 2686 7: 3872 8: 2584 9: 3645 10: 1911 11: 3866
    12: 1937 13: 2583 14: 2582 15: 3875 16: 2585 bogomips: 124863
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Vulnerabilities:
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: spec_store_bypass
    mitigation: Speculative Store Bypass disabled via prctl
  Type: spectre_v1
    mitigation: usercopy/swapgs barriers and __user pointer sanitization
  Type: spectre_v2
    mitigation: Retpolines, IBPB: conditional, STIBP: conditional, RSB filling
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
[ricklinux@rick-ms7c37 ~]$ 

What packages do i need for sensors? Do i have any set up also?

So it looks like I’m limited by my B450 board, cannot load amd-pstate on my desktop, so I’m forced to use the acpi-cpufreq instead. I do have the latest BIOS that supports the Zen3 core processors and looks like the AMD AGESA version is 1.2.0.3b. But no amd-pstate ability for me, so doesn’t look very impressive.

root@drendari:~# cpupower frequency-info 
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 2.20 GHz - 4.43 GHz
  available frequency steps:  3.60 GHz, 2.80 GHz, 2.20 GHz
  available cpufreq governors: performance schedutil
  current policy: frequency should be within 2.20 GHz and 3.60 GHz.
                  The governor "schedutil" 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:  3600MHz
    Pstate-P1:  2800MHz
    Pstate-P2:  2200MHz

ah its

 local/lm_sensors 1:3.6.0.r41.g31d1f125-1
    Collection of user space tools for general SMBus access and hardware monitoring

and you can ruin sudo sensors-detect but should show something without that already

Oh…they are installed?

Edit: I’m building and installing the amdkernel so it might show high.

https://clbin.com/U7OJL

Edit: This has been running for quite some time. Not sure how long it takes?

This will be the same as i have for my board B550 Gigabyte… i had the acpi-cpufreq also before without forcing it to load…
Same for some output for temperatures and fan speeds i need to set acpi_enforce_resources=lax
and modules:
https://aur.archlinux.org/packages/it87-dkms-git/

https://wiki.archlinux.org/title/Lm_sensors#Asus_B450M-A/A320M-K/A320M-K-BR_motherboards

k10temp-pci-00c3
Adapter: PCI adapter
Tctl:         +68.1°C  
Tccd1:        +66.8°C

If you do not run Games or VM at the moment it should not be over 60°C :wink:
Mine is on 40°C currently while running installer ISO on VM …

It’s running the build package for the amdkernel which has been going for a while.

1 Like

I’ll see when I get home. I’ve got AMD in a laptop, now I’m curious.

yea do not let joe play with new hardware it never will get boring :wink:

1 Like

can take some time indeed… i am to lazy to build kernels and just take the repo…

I can add the repo? Maybe i can stop this then?

Edit I just aborted!

What repo do i add? Is this done under akm or just add to pacman.conf?

[linuxkernels]
Server = http://nhameh.ovh/$repo/$arch
SigLevel = Optional TrustAll

inside /etc/pacman.conf
will appear in akm after this too

Does the entry need to be at the top of the list?

at the end it does only provide additional kernels

It didn’t work. I am using rEFInd and it had an extra icon but wouldn’t boot into it. Had to hard reset.