Low CPU Frequency on Laptop Intel i7-13700H (intel_pstate)

Hello,

I got a new laptop (SCHENKER VISION 14 with Intel i7-13700H) and installed NixOS. Following the Wiki, I enabled auto-cpufreq over the flake install on GitHub.

Linux distro: NixOS 24.05 Uakari
Linux kernel: 6.8.4
auto-cpufreq version: 2.2.0 (git: )
Processor: 13th Gen Intel(R) Core(TM) i7-13700H
Cores: 20
Architecture: x86_64
Driver: intel_pstate

NixOS laptop configuration:

powerManagement.enable = false;
services.thermald.enable = false;
services.tlp.enable = false;

programs.auto-cpufreq = {
  enable = true;
  settings = {
    battery = {
       governor = "powersave";
       energy_performance_preference = "power";
       turbo = "never";
    };
    charger = {
       governor = "performance";
       energy_performance_preference = "performance";
       turbo = "auto";
    };
  };
};

auto-cpufreq seems to work, as when idle the state is

------------------------------ Current CPU stats ------------------------------

CPU max frequency: 2400 MHz
CPU min frequency: 400 MHz

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

Battery is: charging

Setting to use: "performance" governor
Setting to use: "performance" EPP

Total CPU usage: 1.9 %
Total system load: 1.62
Average temp. of all cores: 40.10 °C

Load optimal (load average: 1.62, 6.64, 4.82)
setting turbo boost: off

Now when putting the system on a little load for i in {1..2}; do yes > /dev/null &; done I see that turbo boost kicks in and the CPU frequencies go higher. Not to the 4800Mhz exactly, but it seems okay.

------------------------------ Current CPU stats ------------------------------

CPU max frequency: 4800 MHz
CPU min frequency: 400 MHz

Core    Usage   Temperature     Frequency
CPU0     54.0%        52 °C      4226 MHz
CPU1      6.0%        52 °C      4306 MHz
CPU2      0.0%        43 °C       400 MHz
CPU3      0.0%        43 °C       400 MHz
CPU4      0.0%        46 °C      1385 MHz
CPU5      0.0%        46 °C       400 MHz
CPU6      1.0%        39 °C       400 MHz
CPU7      0.0%        39 °C       400 MHz
CPU8      1.0%        42 °C       400 MHz
CPU9      0.0%        42 °C       400 MHz
CPU10     0.0%        41 °C       400 MHz
CPU11     0.0%        41 °C       400 MHz
CPU12     2.0%        45 °C      3110 MHz
CPU13     4.0%        45 °C       400 MHz
CPU14     3.0%        45 °C      3351 MHz
CPU15     0.0%        45 °C       400 MHz
CPU16    41.4%        50 °C       400 MHz
CPU17     0.0%        50 °C      3400 MHz
CPU18   100.0%        50 °C      3351 MHz
CPU19     1.0%        50 °C       400 MHz

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

Battery is: charging

Setting to use: "performance" governor
Setting to use: "performance" EPP

Total CPU usage: 23.5 %
Total system load: 1.69
Average temp. of all cores: 45.30 °C

High CPU load (load average: 1.69, 1.07, 1.23)
setting turbo boost: on

My problem starts when putting a lot of load for i in {1..20}; do yes > /dev/null &; done
The CPUs apparently are very low on frequency and also the Temperature of the notebook is quite low. I would imagine the CPU going at least to 80°C before throttling the frequencies.

------------------------------ Current CPU stats ------------------------------

CPU max frequency: 4800 MHz
CPU min frequency: 400 MHz

Core    Usage   Temperature     Frequency
CPU0    100.0%        50 °C      2319 MHz
CPU1    100.0%        50 °C      2319 MHz
CPU2    100.0%        54 °C      2400 MHz
CPU3    100.0%        54 °C      2400 MHz
CPU4    100.0%        51 °C      2400 MHz
CPU5    100.0%        51 °C      2400 MHz
CPU6    100.0%        49 °C      2400 MHz
CPU7    100.0%        49 °C      2400 MHz
CPU8    100.0%        49 °C      2400 MHz
CPU9    100.0%        49 °C      2400 MHz
CPU10   100.0%        50 °C      2400 MHz
CPU11   100.0%        50 °C      2400 MHz
CPU12   100.0%        51 °C      1600 MHz
CPU13   100.0%        51 °C      1600 MHz
CPU14   100.0%        51 °C      1600 MHz
CPU15   100.0%        51 °C      1600 MHz
CPU16   100.0%        54 °C      1600 MHz
CPU17   100.0%        53 °C      1600 MHz
CPU18   100.0%        53 °C      1600 MHz
CPU19   100.0%        53 °C      1600 MHz

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

Battery is: charging

Setting to use: "performance" governor
Setting to use: "performance" EPP

Total CPU usage: 100.0 %
Total system load: 8.06
Average temp. of all cores: 51.15 °C

High CPU load (load average: 8.06, 2.70, 1.74)
setting turbo boost: on

Is this a kernel problem of the intel_pstate driver or am I configuring something wrong in NixOS?

Thanks for your help in advance.

I’m curious, why is powerManagement.enable set to false?

I tested with powerManagement.enable = true and also used TLP instead of auto-cpufreq. Just wanted to show in the config, that these are not interfering.

It may be interference from power-profiles-daemon. It is turned on by default by most desktop environments. Example

Perhaps try turning it off with

services.power-profiles-daemon.enable = false;

I use dwm without desktop environment, so power-profiles-daemon is disabled. However that gave me an idea.

I checked the /sys/devices/virtual/powercap/intel-rapl/intel-rapl:0/constraint_0_power_limit_uw file (and also constaint_1_power_limit_uw. It has the content 45000000 which means 45 Watt.

The i7-13700H has a base power usage of 45W, but needs 115W on turbo. So it seems the processor never gets enough power. I changed the limit of both constraints to 120W by doing

echo 120000000 | sudo tee /sys/devices/virtual/powercap/intel-rapl/intel-rapl:0/constraint_0_power_limit_uw

It actually helped, but still not the desired frequency, as performance cores should have 5GHz and efficiency cores should have 3.7 GHz

------------------------------ Current CPU stats ------------------------------

CPU max frequency: 4800 MHz
CPU min frequency: 400 MHz

Core    Usage   Temperature     Frequency
CPU0    100.0%        61 °C      3200 MHz
CPU1    100.0%        61 °C      3200 MHz
CPU2    100.0%        63 °C      3200 MHz
CPU3    100.0%        63 °C      3200 MHz
CPU4    100.0%        61 °C      3200 MHz
CPU5    100.0%        61 °C      3200 MHz
CPU6    100.0%        59 °C      3200 MHz
CPU7    100.0%        59 °C      3200 MHz
CPU8    100.0%        60 °C      3200 MHz
CPU9    100.0%        60 °C      3200 MHz
CPU10    100.0%        60 °C      3200 MHz
CPU11    100.0%        60 °C      3200 MHz
CPU12    100.0%        60 °C      2500 MHz
CPU13    100.0%        60 °C      2500 MHz
CPU14    100.0%        60 °C      2500 MHz
CPU15    100.0%        60 °C      2500 MHz
CPU16    100.0%        62 °C      2500 MHz
CPU17    100.0%        62 °C      2500 MHz
CPU18    100.0%        62 °C      2500 MHz
CPU19    100.0%        61 °C      2500 MHz

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

Battery is: charging

Setting to use: "performance" governor
Setting to use: "performance" EPP

Total CPU usage: 100.0 %
Total system load: 8.15
Average temp. of all cores: 60.75 °C

High CPU load (load average: 8.15, 9.11, 5.73)
setting turbo boost: on

Not sure what exactly is happening, because after reboot, the files are reset to 45W again (expected after reboot) but the CPUs keep being at higher frequencies and also higher temperatures. Not sure if this setting changed anything before tbh.

------------------------------ Current CPU stats ------------------------------

CPU max frequency: 5000 MHz
CPU min frequency: 400 MHz

Core    Usage   Temperature     Frequency
CPU0    100.0%        74 °C      3200 MHz
CPU1    100.0%        74 °C      3200 MHz
CPU2    100.0%        76 °C      3200 MHz
CPU3    100.0%        76 °C      3200 MHz
CPU4    100.0%        73 °C      3200 MHz
CPU5    100.0%        73 °C      3200 MHz
CPU6    100.0%        74 °C      3200 MHz
CPU7    100.0%        74 °C      3200 MHz
CPU8    100.0%        72 °C      3200 MHz
CPU9    100.0%        72 °C      3200 MHz
CPU10    100.0%        75 °C      3200 MHz
CPU11    100.0%        75 °C      3200 MHz
CPU12    100.0%        73 °C      2500 MHz
CPU13    100.0%        73 °C      2500 MHz
CPU14    100.0%        73 °C      2500 MHz
CPU15    100.0%        73 °C      2500 MHz
CPU16    100.0%        72 °C      2500 MHz
CPU17    100.0%        73 °C      2500 MHz
CPU18    100.0%        73 °C      2500 MHz
CPU19    100.0%        73 °C      2500 MHz

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

Battery is: charging

Setting to use: "performance" governor
Setting to use: "performance" EPP

Total CPU usage: 100.0 %
Total system load: 17.94
Average temp. of all cores: 73.55 °C

High CPU load (load average: 17.94, 7.02, 2.60)
setting turbo boost: on

Maybe some thermal throttling is kicking in now. Also not sure if this is a NixOS problem or a Linux problem in general with the Notebook hardware.

Thanks however to everyone who helped so far.