TL;DR: thermald with a custom config.
My laptop kept dropping to 200 MHz under load, and I spent a while trying to fix it. Damn LLMs didn’t give me a clean solution right away. Here’s what didn’t help:
- Changing the CPU governor
- Changing the EPP setting
- Capping the CPU frequency at 3.5–4 GHz
- Capping PL1 at 20–25 W
- Running
thermald with defaults
Even with those changes, the CPU still dropped to 200 MHz under heavy load.
You can put hard limits on CPU frequency and PL1, but then the laptop runs like a potato.
Chassis heat soak seemed to trigger the 200 MHz drops, and CPU overheating sometimes caused them too. In plain words, heat was building up in the laptop’s case, as I understand it.
In my case, it looks like thermald only used the CPU temperature to decide when to reduce CPU power.
What we need is the Wi-Fi module temperature, which you can check with sensors.
sudo pacman -S lm_sensors
sensors
You should see something like this.
iwlwifi_1-virtual-0
Adapter: Virtual device
temp1: +45.0°C
That’s the one we need. This should work on recent linux-surface and stock kernels that expose the iwlwifi thermal sensor. Tested on 7.3.4-arch1-1 and 7.3.4-arch1-1-surface
Install and enable thermald.
sudo pacman -S thermald
Add the custom config at /etc/thermald/thermal-conf.xml
sudoedit /etc/thermald/thermal-conf.xml
<?xml version="1.0"?>
<ThermalConfiguration>
<Platform>
<Name>Surface Laptop 4 Custom</Name>
<ProductName>*</ProductName>
<Preference>QUIET</Preference>
<ThermalSensors>
<ThermalSensor>
<Type>x86_pkg_temp</Type>
<AsyncCapable>0</AsyncCapable>
</ThermalSensor>
<ThermalSensor>
<Type>iwlwifi_1</Type>
<AsyncCapable>0</AsyncCapable>
</ThermalSensor>
</ThermalSensors>
<ThermalZones>
<ThermalZone>
<Type>x86_pkg_temp</Type>
<TripPoints>
<TripPoint>
<SensorType>x86_pkg_temp</SensorType>
<Temperature>90000</Temperature>
<type>passive</type>
<ControlType>SEQUENTIAL</ControlType>
<CoolingDevice>
<index>1</index>
<type>rapl_controller</type>
<influence>100</influence>
<SamplingPeriod>2</SamplingPeriod>
</CoolingDevice>
</TripPoint>
</TripPoints>
</ThermalZone>
<ThermalZone>
<Type>iwlwifi_1</Type>
<TripPoints>
<TripPoint>
<SensorType>iwlwifi_1</SensorType>
<Temperature>52000</Temperature>
<type>passive</type>
<ControlType>SEQUENTIAL</ControlType>
<CoolingDevice>
<index>1</index>
<type>rapl_controller</type>
<influence>100</influence>
<SamplingPeriod>4</SamplingPeriod>
</CoolingDevice>
</TripPoint>
</TripPoints>
</ThermalZone>
</ThermalZones>
</Platform>
</ThermalConfiguration>
thermald should pick this file automatically (if adaptive mode is inactive and there’s no auto-generated config).
sudo systemctl enable --now thermald.service
I chose 90 °C for the CPU and 52 °C for the Wi-Fi module. You can tweak those a little. 55 °C didn’t work for me, so I lowered it to 52 °C and now I can compile as much slop as I want.
Maybe someone will find this useful.
Edit: I'm using Arch btw.