CPU temperatures in linux: throttling or wrong reading

cpucpu-frequencygamesinteltemperature

Using a Lenovo Legion Y520 with i7-7700HQ (base clock 2.8Ghz) and GTX 1050.

I'm getting CPU overheating warnings in linux and it's affecting my performance in games (found in Payday 2 and CS:GO). I've never had problems in Windows.

This is what I found when trying to troubleshoot this issue:

In Windows 10 (using aida64)

  • Windows stays at around 3.4 Ghz on idle (no idea why this is so high with less than 3% cpu usage), with a temperature of around 50C.

  • When stressing the cpu, the temperature goes slowly (in a couple seconds instead of instantly) from about 50C to around 75C and stays there comfortably. Clock speeds are about 2.9Ghz when stressing. Utilization is always 100%. Aida64 doesn't report throttling. The voltage on the CPU core coes from about 1.1 to 0.9 when stressing.

In Arch Linux (using s-tui)

  • Linux stays at around 2.0Ghz on idle, with a temperature of around 50C.

  • Here's where it gets weird: when stressing the cpu, the temperature IMMEDIATELY goes from 50C to about 93C. Clock speeds are exactly 3.4Ghz when stressing. Utilization is always 100%. When turing the stress test off, the temperature IMMEDIATELY goes back to about 50C, as if nothing ever happened. The laptop certainly doesn't feel like it heats up to 90C+ when doing this, even after a long stress.

Here's an image that shows how temperature, power, and frequency all go down at the exact same time. Notice how much cpu temperature changes in so little time.
Image of throttling in linux

How do I fix this throttling issue? Do I undervolt my CPU in linux? How come it reads temperatures wrong in Linux but not in Windows?

I changed the profile using cpupower from powersave to performance. I still see the same throttling in s-tui. There is a jump up in idle cpu frequency when setting to performance (instead of around 2000-2500Mhz to always at 3400Mhz), but that's the only thing that has changed.

Fan control

I tried to control fans using fancontrol (lm_sensors), but pwmconfig says there are no pwm-capable sensor modules installed.

I tried it with NBFC, but it doesn't seem to be doing anything, no matter what profile I choose. I don't even know if NBFC can control my fans, but it doesn't report any errors when choosing a profile.

I also tried thinkfan, but it doesn't seem to help with throttling. It also thinks my fan's speed is at 8RPM, see this thread

Solution

I found that lowering the maximum allowed cpu frequency using cpupower to something like 3100MHz instead of the default 3800 fixes all issues.

sudo cpupower frequency-set -u 3100MHz

I also changed max_freq in /etc/default/cpupower to the same value, to make it permanent. I found that this does result in a slight fps drop in games, but nothing serious. At least my fps is stable 🙂

Sadly I think this might result in decreased performance in non-gaming tasks like when compiling something.

After 1.5 years

I just stability tested Windows again (with AIDA64) and found it now also thermal throttles. As you can see in the image below the temperatures jump quickly to the high 90s and AIDA64 reports throttling. The clock speed idles at 3.4GHz and a few seconds after starting the test it drops to around 800MHz, before jumping up to 3.4GHz again a second later. It doesn't decide to lower the clock speed while stresstesting to something like 2.9GHZ (like before).

AIDA64 on Windows, power setting = High Performance

How come it suddenly stopped lowering the maximum frequency in Windows?

Best Answer

The difference is due to windows and linux using different CPU throttling profiles.

You do have some control over this on linux. For example, the following command will show you which profile is currently being used:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

There are ways to choose which profiles to use. The Arch Linux wiki has good information on this, it may be worth a read:

CPU Frequency Scaling - Arch Wiki

There is an additional issue of fan control -- you need to make sure you have the proper drivers for controllin your fans and that they are set to a high enough speed when gaming.

Linux on Laptops can be a helpful resource.

Related Question