1

On upgrading from 20.04 - 20.10 I have noticed a massive degrading of performance, my laptop has basically become unusable. After a bit of digging it turned out that all CPUs were constantly scaled to 400 MHz.

After I changed the governor to performance and set a min_speed of 1.2 GHz in /etc/init.d/cpufrequtils:

...
ENABLE="true"
GOVERNOR="performance"
MAX_SPEED="4900000"
MIN_SPEED="1200000"
...

and I rebooted, it seemed to be better - the CPUs hovered around 1.2 GHz, and the frequency went up when the load increased. However, there are still stretches of time (sometimes a few seconds, sometimes several minutes) where all CPU frequencies "flatline" at 400 MHz, ignoring system load.

Interestingly, /sys/devices/system/cpu/cpufreq/policy*/cpuinfo_min_freq is somehow reset to 400000, which indicates to me that something else seems to be running that interferes with normal cpu frequency scaling. However, I have not been able to identify what.

I have tried to get out of such a "flatline" by installint auto-cpufreq, but the output is quite interesting:

-------------------------------------------------------------------------------

Linux distro: Ubuntu 20.10 (Groovy Gorilla)
Linux kernel: 5.8.0-41-generic
Processor: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
Cores: 8
Architecture: x86_64
Driver: intel_pstate

------------------------------ Current CPU states ------------------------------

CPU max frequency: 4700 MHz
CPU min frequency: 1200 MHz

         Usage  Temperature  Frequency
CPU0:    47.5%     55 °C      400 MHz
CPU1:    74.7%     54 °C      400 MHz
CPU2:    43.2%     55 °C      400 MHz
CPU3:    45.3%     53 °C      400 MHz
CPU4:    41.2%     55 °C      400 MHz
CPU5:    42.0%     54 °C      400 MHz
CPU6:    32.6%     55 °C      400 MHz
CPU7:    38.1%     53 °C      400 MHz

---------------------------- CPU frequency scaling ----------------------------

Battery is: charging

Setting to use: "performance" governor

Total CPU usage: 22.4 %
Total system load: 2.51
Average temp. of all cores: 54.25 °C

Load optimal
setting turbo boost: on

-------------------------------------------------------------------------------

...a min CPU frequency of 1200 MHz, but actual CPU frequency of 400 MHz?

Temperature seems not to be a problem by the way, all the cores are hovering well below 55°C all the time.

So, I'm at a loss. Any idea what the cause could be and what could help? This is massively frustrating, as sometimes the system just starts choking on simple tasks such as switching from tab to tab in Firefox, while all CPUs sit at 400 MHz...

Update: Something seems to be messing with the governor settings. I tried this:

date -Ins; for i in 0 1 2 3 4 5 6 7; do echo "performance" > /sys/devices/system/cpu/cpu${i}/cpufreq/scaling_governor; done
date -Ins; cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
sleep 1
date -Ins; cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
sleep 1
date -Ins; cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

And the output is:

root@TuxBook:~# bash governortest 
2021-02-03T11:37:37,469836025+01:00
2021-02-03T11:37:37,493420506+01:00
performance
performance
performance
performance
performance
performance
performance
performance
2021-02-03T11:37:38,516823999+01:00
powersave
powersave
powersave
powersave
powersave
powersave
powersave
powersave

So, within something between 0-1 seconds after me setting the governor to performance, it is back to powersave. It is not gamemode, as a google search suggested, I already purged gamemode.

I tried watching /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor with auditctl -w /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor -p w -k cpu, but all that comes up in ausearch are the calls from the script above, nothing afterwards to reset it. I'm at a loss...

4
  • I'd google. That seems to be a bug in the kernel.
    – kanehekili
    Feb 2, 2021 at 22:15
  • Does this happen after the machine wakes from sleep, or does it happen any time regardless of how the system is being used?
    – user1091774
    Feb 2, 2021 at 22:29
  • It happens at any time, regardless of system usage. Sometimes, while I am actually doing compute-intensive things, it just goes down to 400 MHz for a while. Right after system reboot, it starts out OK for a while, and it seems to get worse with increasing uptime (e.g. currently, after about 12 hours of uptime, it has been at 400 MHz for 2 hours under moderate use, with just a few minutes of normal speed, while in the first hours after reboot it just had a few 30-ish-second-stretches of "flatlines"), but this could just be coincidence.
    – Garanthor
    Feb 3, 2021 at 9:07
  • Thanks for the kernel suggestion, I found this here: old.reddit.com/r/linux/comments/ihdozd/… - but, there seems to be an additional problem. I did for i in 0 1 2 3 4 5 6 7; do echo "performance" > /sys/devices/system/cpu/cpu${i}/cpufreq/scaling_governor; done. This fixed the problem for a moment, but then it flatlined again. Now, when I do the same thing and immediately cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor it all comes up as "powersave" - apparently, something keeps overwriting the governor with "powersave"?
    – Garanthor
    Feb 3, 2021 at 9:28

1 Answer 1

1

I have observed the same symptoms when upgrading from 20.10 to 21.04.

It turned out that thermald was causing these issues.

thermald is installed on kubuntu 20.10 and 21.04. However, on 20.10 thermald fails to start.

You can check if thermald is running by looking at the output of

ps aux |grep thermald

When I stop thermald on 21.04, throttling to 400 MHz stops.

sudo systemctl stop thermald

However, at this point some settings have already been changed and thermald doesn't seem to restore those settings when stopping. So I've simply removed thermald completely.

sudo apt remove thermald

After a restart 21.04 is behaving almost identically to 20.10. The base frequency is a bit lower (1300 MHz instead of 1800 MHz), but the peak and long-term frequencies under load are the same.

Instead of uninstalling thermald, deactivating should have the same effect:

sudo systemctl disable thermald.service
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.