When you look back a decade or so, one of the things that sometimes was a bit of a hassle when installing Linux on a notebook was to get fan control working correctly. And correctly means that the fan doesn’t run all the time, or on full speed for just a few seconds when the temperature rises, just to stop again and then repeating this every few seconds. Also, I noticed in the past that power control, which is a related topic, was sometimes not working well with older Linux kernels. As soon as the temperature started to rise, the CPU clock frequency went to the lowest possible setting and just remained there for a long time. In other words, the notebook would run fine, but was seriously lacking performance. Fortunately, this seems to be something of the past, and I didn’t have to tweak anything in that regard on the Lenovo and HP notebooks I installed Ubuntu on in the past two years. That being said, there are some interesting differences how power and heat management is handled on different notebooks with the same Ubuntu Linux (22.04), and I thought I’d document this here for my and your reference.
CPU Clock Rate
On current notebooks, CPU performance depends on two things: CPU clock speed and CPU utilization. 100% CPU utilization is not a fixed amount of processing power. When the CPU is cold, the clock rate of the CPU cores could, for example, be 3.8 GHz. Then, as the CPU cores get warmer, tools like ‘htop’ still show 100% CPU utilization during performance intensive applications, but the CPU clock frequency is way lower, let’s say to 2 or even 1 GHz. In other words, when the CPU is hot, one only gets a fraction of the performance out of the CPU despite the CPU being at 100% load.
Performance Settings
This is where cooling and fan control comes into play. Recent Ubuntu versions have an option in the menu to set the CPU cores into ‘performance’, ‘balanced’ or ‘power saver’ mode. ‘Balanced’ mode is the default. And indeed, on all three notebooks I’ll discuss below, the different settings triggered different behaviors when the CPU is under load.
These days, fan control and temperature control for the CPU and other components of the notebook seems to be split between the operating system, the Linux kernel, the BIOS (ok, the UEFI) and the CPU itself. The split might perhaps even depend on whether an Intel or an AMD CPU is used, as well as the chip generation. I have no idea of the details behind this, I just wanted to find out what high level behavior different notebooks showed under high CPU load to ensure the clock rate would not just be set to the lowest value and the fan not being managed correctly.
How to Load – Test
For the load tests in this post, I used the ‘stress’ mode in s-tui, a very cool command line tool that shows a lot of details such as temperature and CPU clock speeds of each core, fan speeds and many other things. s-tui is part of the Debian repository, so it can be installed with a simple sudo apt install s-tui command. When the stress test is started, all CPU cores get work to do, and a convenient timer is shown in the program that can be used to note the time when the CPU cores start to get throttled.
So there we go, now lets have a look at the behavior of a number of different notebooks.
A 2021 – Lenovo Thinkpad L14 Gen 2 – Intel
This 3 year old notebook initially gave me quite a bit of a headache in 2021. When under heavy CPU load, the CPU would just be set to the lowest clock frequency. There were some tools available to prevent this by manually setting higher power levels. While this fixed the situation, it was a bit of a kludge. Fast forward to 2024 and the issue is now fixed with Ubuntu 22.04 and Linux kernel 6.8.
In ‘balanced’ power mode, the core temperature is around 40C without any significant load. When the stress test is started, all 4 cores / 8 threads are clocked at 3.8 GHz, and CPU temperature quickly rises to 95C. After around 20 seconds into the test, the cores are throttled down to 1.6 GHz, with a 7W CPU and 14W overall power consumption. The temperature then goes down to 50C and the fan keeps running at 3630 rpm. This seems to be the final state, as all values remained constant for the next 5 minutes. For normal usage scenarios this approach looks OK to me. One has the power in case it is needed for a few seconds (e.g. webpage rendering), while keeping the notebook at a reasonable temperature over the long term in case load does not decrease. If one stops the test, waits 15 seconds and then starts another stress test, one can observe the cores going to 2.4 GHz for a few seconds, before being throttled down to 1.6 GHz again. This means that the process adapts to current CPU temperature and is not an ‘all or nothing’ approach.
In ‘performance’ mode, the tests starts with a fan speed of 2600 rpm. Once the stress test is running, the CPU package draws 31W and the the overall system is pushed to 44W. All cores run at 3.8 GHz and the CPU temperature rises to 92C. These values are held, there is no throttle down. This means that one has the option to get the maximum out of the platform at the expense of the notebook getting quite warm and the fan becoming noticeable at a speed of 4570 rpm. I’d call this the ‘brute force’ approach.
A 2023 Lenovo Thinkpad T14 Gen 4 – 1335U (13th Gen Intel i5 CPU)
The T14 line is Lenovo’s flagship notebook category, and the power/heat/fan is handled as follows with the same setup (Ubuntu 22.04, Linux kernel 6.8):
In ‘balanced’ power mode, the CPU and overall system can draw 30W and 40W respectively when s-tui’s stress test is started. The P-cores are clocked at 3.8 GHz for the first 15 seconds, while the E-cores are clocked at 2.5 GHz. After that, the power is reduced to 13 and 20W for the overall system. The P-Cores are then clocked at 2.1 GHz, while the E-cores are clocked at 1.6 GHz (P = Performance, E = Efficiency CPU Cores). The fan then runs on 3000 rpm and temperature is held at 60C.
In ‘performance’ mode, the system also starts at 30/40W CPU/overall system and 3.8/2.5 GHz P-Core E-Core clock rate. After around 15 to 20 seconds, power is reduced to 20/27W and P-/E-core clock rate is reduced to 2.9/2.0 GHz. The fan runs at 3400 rpm and the CPU temperature is held at 73C for several minutes until I ended the test.
Fan behavior of this T14 is very interesting. After the tests, the fan keeps running for much longer than what seems to be required by the temperature indication. But it’s very silent so it is not a problem. Even more interesting: When closing the lid, the notebook goes into suspend, but the fan keeps running for a few minutes. That’s a strong indication that the fan is controlled by the BIOS/UEFI during that phase. This is the first notebook where I have seen this behavior, all my other notebooks stop the fan when going into suspend, even if the system is still very hot from a ‘performance’ test. I was startled when I noticed this behavior for the first time and thought that there is an issue here. But it’s not a bug, it’s definitely a feature.
A 2023 Lenovo Thinkpad E14 Gen 5 with an AMD 7330U CPU
The ‘Thinkpad E’ is Lenovo’s entry-level Thinkpad line, but heat/power/fan levels are nicely controlled by the overall system as well. In ‘balanced’ mode, the s-tui stress test pushes the power to 25W for the CPU and 4.7W for the system, and a CPU clock rate of 3.7 GHz (all cores). After 15 seconds, clock rate is reduced to 3.4 GHz and a power draw of 20W/3.7W. This is the final state and the fan is ramped up over time from 1900 rpm to 2700 rpm while the maximum temperature is held at 73C.
In ‘performance’ mode, the CPU and system draw 30W and 6W respectively, cores are clocked at 3.8 GHz, and the CPU temperature quickly rises to 95C. The fan speed is then gradually ramped up from 1900 to 3300 rpm over the next several minutes. At the end of my test after 7 minutes, the system was still allowed to draw 30W/6W and the temperature stayed constant at 98C.
Summary
Three systems, three different behaviors. The L14 has a very conservative ‘balanced’ mode while ‘performance mode’ goes to the very limits. The T14 has a less conservative ‘balanced’ mode with a CPU temperature that is 10C higher than on the L14 in the same mode. Performance mode is more conservative here, the core temperatures remain at 70C instead of 90C+. And finally the E14 seems to be somewhere in between. I don’t have a personal preference, all three behaviors seem to be fine to me.