[RESPONDED] AMD 7040 Sleep States

Hi All, as many others, I’ve been ecstatic to receive & setup my Ryzen Framework 13!

Currently running: Ubuntu 22.04.3 LTS

I’ve been interested in understanding the difference between acpi-cpufreq and amd-pstate specifically to optimize performance on AC and longevity on battery.

For the purpose of testing after reading more about the power-profiles-daemon, I disabled it and enabled TLP. Of note, after updating /etc/tlp.conf directly or via tlpui, it must be reloaded: $ sudo systemctl reload tlp

With this in mind, I started by comparing kernels. The current default kernel on the above OS is 6.2.0-36 which along with the suggested 6.1.0-1025-oem operate power management via acpi-cpufreq. This is hamstrung as it only offers 3 cpu freqs: 1.6, 2.2, 3.5 Ghz. One advantage it has is it will follow the min & max freq settings either provided via tlp or directly via /sys/devices/system/cpu/cpufreq/policy*/scaling_min_freq | scaling_max_freq (amd-pstate does not follow these from what I’ve seen).

Meanwhile, kernel 6.5.0-1007-oem enables amd-pstate by default. Details on either can be seen via: $ cpupower frequency-info (this required I install the linux-tools-common and respective kernel linux-tools pkgs, I also installed btop while I was at it).

Of note: amd-pstate opens up the the entire freq range, which shows on my system as 400Mhz - 4.8Ghz.

Another key feature, is this allows real-time switching between pstate methods. By default:
$ cat /sys/devices/system/cpu/amd_pstate/status
$ active

When set to active, there is an option to specify energy pref either via TLP or directly:
$ echo 'power' | sudo tee /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference

For more control, this can be changed to passive or guided. My testing thus far has been with the latter:
$ echo 'guided' | sudo tee /sys/devices/system/cpu/amd_pstate/status

This in turn, gives access to disabling AMD’s turbo core (this is accessible via TLP after the above status has been set):
$ echo 0 | sudo tee /sys/devices/system/cpu/cpufreq/boost

This reduces the max freq from 4.8Ghz to 3.5Ghz. From what I’ve seen, this means max draw goes from 28W to 18W.

Shout out to @topocount for the sample tlp.conf as I reviewed that as part of this testing.

Some metrics from this post:
a) started at 25% batt with an est 1 hr 40 mins @ 7.71W draw (per powertop, quickly settled down)
b) 1 hr later, at 15% batt with est 1 hr 15 mins @ 5.82W draw

Note: apps open include 2 firefox windows with 10 total tabs, 5 terminals (1 running powertop, another $ watch -n 2 /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq

This indicates AMD power optimization still has some fine tuning to do. I’ll report back as I collect more observations.

Reading of interest:
AMD Pstate Kernel Doc
TLP Processor & other settings

11 Likes