Hardware : Lenovo Thinkpad P14s, Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
Software : Ubuntu 21.10, Gnome 40.4.0, Linux 5.13.0
Lenovo has a "Lenovo Intelligent Thermal Solution" which is hardwired to some movement sensors that detect when the laptop has been moved. It then switches to "lap mode" so it throttles the CPU in order to lower the hardware temperature and allow safe use on your lap.
For months, this created problems on Linux where this feature was not supported, so the laptop was always stuck on lap mode, and performance was always throttled.
This has been fixed since mid-2020, details about this can be found in this document : https://web.archive.org/web/20190926163900if_/https://forums.lenovo.com/lnv/attachments/lnv/Special_Interest_Linux/13642/1/Linux%20Thermal%20throttling.pdf
When moving the laptop, "lap mode" is triggered, so the "performance" power mode in disabled, and it is automatically set to "balanced power". After approximately 5 minutes, "lap mode" turns off, and you can turn the power mode back to "performance", but it is a manual action.
First, install the power-profiles-daemon
package.
Here is the powerprofilesctl
command output when set to performance mode :
$ powerprofilesctl
* performance:
Driver: platform_profile
Inhibited: no
balanced:
Driver: platform_profile
power-saver:
Driver: platform_profile
Here is the powerprofilesctl
command output when "lap mode" is detected :
$ powerprofilesctl
performance:
Driver: platform_profile
Inhibited: yes (lap-detected)
* balanced:
Driver: platform_profile
power-saver:
Driver: platform_profile
Gnome setting's "power" page gives similar information.
/sys/devices/platform/thinkpad_acpi/dytc_lapmode
is set to is 1 when lap mode is detected. It goes back to 0 after around 5 minutes without movement.
See https://github.com/JosiahBull/thinkpad_acpi
This is the best solution if it works with your setup. Tested by its developer on Fedora 34/35/36 and Ubuntu 20.04/22.04. Also tested by me on Ubuntu 21.10.
Upgrading Gnome (if you can) is the best solution. When Gnome 41/42 detects lap mode, it switches to a "degraded performance mode", which does not really seem to throttle the CPU. It doesn't switch to "balanced power" mode, so you don't need to restore performance mode after lap mode detection turns off.
Here is the powerprofilesctl
command output when in "degraded performance mode" :
$ powerprofilesctl
* performance:
Driver: platform_profile
Degraded: yes (lap-detected)
balanced:
Driver: platform_profile
power-saver:
Driver: platform_profile
You can run this script in a crontab every minute, to automatically turn power mode to "performance" as soon as possible :
p=$(powerprofilesctl) ; if echo "$p" | grep -qF "* balanced" && ! echo "$p" | grep -qF "Inhibited: yes" ; then powerprofilesctl set performance ; fi
WARNING : be sure to test your script, as any error will be repeated every minute !
When performance mode is inhibited, you can use the Fn
+ h
shortcut to turn performance mode on. Of course it won't apply immediately, but it will apply as soon as lap mode is over. This is better than nothing...
See the "other solutions" paragraph in https://github.com/JosiahBull/thinkpad_acpi
In theory, this could be done, altough the proposed script is not functional (see JosiahBull/thinkpad_acpi#4)
You can disable CPU thermal throttling altogether, but this is a "nuclear option", as described in https://wiki.archlinux.org/title/Lenovo_ThinkPad_X1_Extreme#Disabling_BDPROCHOT_to_prevent_throttling_on_battery
Many tools are available for this.
One of the easiest is to install the i7z
package, then run sudo i7z
in a terminal.
It will display the actual frequency, temperature and voltage for each CPU core.
Then generate some load, for example using stress-ng
:
stress-ng --cpu 8 --timeout 60s
WARNING : This will get your CPU very hot (more than 80 °C) !
WARNING : This will also hog for CPU for one minute, so make sure you have nothing important running at the same time !
You can watch i7z
while stress-ng
is running :
- If your CPU is throttled, each core will run below 1 GHz to keep the temperature down.
- If it is not throttled, each core will run between 3 and 5 GHz.
If you have relevant info about other setups, please leave a comment and I will update this gist.
You know if this happens in P53, I want to assume that this related thing that in occasions while I hear music or I watch videos the audio just gets stuck for a few seconds?