Update 2022-09-09 : I corrected a few typos
This article will unlock the full power of your processor. The laptops these days seem to be locked out of their full potential.
NOTE: If you want to investigate on your machine, I recommend adding the following tools.
Arch : pacman -S btop cpupower turbostat
Ubuntu / PopOS / Debian : will be updated soon 😥
It was a normal evening, I remember doing software updates on my laptop and running BTOP for any suspicious software activities. At first, I found nothing special, then my eyes were locked on the CPU frequency, indicating 1.4 GHz. Was it normal? I did a quick lookup on AMD’s website. My CPU (Ryzen 4700u) comes with a base frequency of 2.0ghz and a max frequency of 4.1 GHz.
I vaguely remember using the power save the configuration, so that was explaining the low frequency but it was never moving up either. I decided to switch governor to see if I can utilize my CPU to the fullest and run some benchmarks. After trying a few different governors: performance, on-demand, and schedutil, I still had no luck. My CPU frequency was going up a bit but it was maxing out at the base clock. It seemed impossible to reach any of the boost frequencies advertised by the manufacturer. Time to ditch Linux? eh NO!
I checked my kernel but it was already at the latest which is 5.17 (March 2022). It should also not be the bios because I was able to max out the machine when it was running Windows.
Investigation for CPU locked
If you run the following command it will give you some information:
From what I was seeing, my CPU doesn’t provide any boost states. If you analyze the results it also says that CPU boost is supported but not active (Active: no).
If CPU boost is supported, it’s now time to activate it!! This requires root privilege.
To enable turbo boost
cpupower frequency-set -g ondemand sudo sh -c "echo '1' > /sys/devices/system/cpu/cpufreq/boost"
To disable turbo boost
sudo sh -c "echo '0' > /sys/devices/system/cpu/cpufreq/boost"
Testing the performance
It’s now time to test. Type the following, it should max out one core of your CPU. You can repeat this if you want to maximize more core. This command doesn’t need any root privileges.
dd if=/dev/zero of=/dev/null
To validate you can run BTOP or TURBOSTAT. Turbostat will report the actual MHZ value in the column named Bzy_MHz. The TSC frequency is the base frequency of the processor.
You can also display the frequencies without any specific tools, simply type this (CTRL-C to quit).
watch cat /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_cur_freq
Turbo boost is now activated! Enjoy!
Do you have to set the CPU governor? it depends. If you want to save power, I think you should disable the boost and use power save. You also have a few other settings you can try: they are documented here.
Please make sure that you do some testing!
Switching power profiles
My laptop is fast enough for most tasks with the power saving profile. You can create a few shell scripts and invoke them as needed
- One for your power saving
- One with schedutil or ondemand for heavier productivity
- One with performance for gaming or 3d rendering.
If you want to use the following, save them in different files, and make sure you enable the execution attribute: chmod +x <script_name>
#!/bin/bash cpupower frequency-set -g powersave sudo sh -c "echo '0' > /sys/devices/system/cpu/cpufreq/boost"
#!/bin/bash cpupower frequency-set -g ondemand sudo sh -c "echo '1' > /sys/devices/system/cpu/cpufreq/boost"
#!/bin/bash cpupower frequency-set -g performance sudo sh -c "echo '1' > /sys/devices/system/cpu/cpufreq/boost"
You might like this related content :
Linux – Fix ALC4080 audio on MSI MPG X570S CARBON MAX WIFI – Luc Raymond’s blog
New BIOS firmware for ThinkBook 15 G2 ARE AMD – Luc Raymond’s blog