Getting full performance even on battery

I use my Librem 13v4 at a desk and would like to get max performance regardless of whether the battery is charging or discharging, if possible. I’m running Fedora 33.

I’ve observed that under prolonged CPU stress whilst discharging the fans never seem to fully spin up and CPU frequency will jump up and down 400MHz-3500MHz whilst temps can reach 90C. As soon as I turn the power on I can hear the fans spin faster, CPU freq settles at a solid 2900MHz and the temp settles at 80C. Jobs finish faster when charging.

Is it unrealistic to expect the same performance whether charging or discharging? It seems to me that when discharging the fans’ RPM is constrained and this in turn limits the CPU. This makes sense to preserve battery power but I am not concerned with that when at a desk.

I understand there is no way to control fan speed with software (see Librem 13 Fan Speed Detection) but is there any other way to tweak the power profile so fans can spin fast even when the battery is discharging? Thanks.

It seems you want to do the opposite to what described here:

Which means, just perform the opposite configuration.

Thanks @fsflover! The post you linked was just what I needed. After some testing I have adopted the policy of turbo on when charging and turbo off when discharging.

Turbo on gives better performance as long as power is connected. In that situation it seems there is sufficient power to cool the CPU and prevent excessive frequency back-off, albeit with plenty of fan noise.

Conversely when discharging having turbo disabled gives much better performance for long-running jobs. The turbo frequencies build up a thermal problem that then has to be dealt with by backing off the freq for a while. Combined with discharging where presumably there is less power available for the fans the CPU will speed up to 3500MHz but then slow down all the way to 400MHz to cool. If turbo is disabled it instead runs at a stable ~2700MHz with little fan noise.

Running sysbench cpu --threads=4 run (higher is better) I see:

  • Charging
    • With turbo enabled: 37k events
    • With turbo disabled: 29k events
  • Discharging
    • With turbo enabled: 20k events
    • With turbo disabled: 28k events

So for me I need turbo disabled when discharging and enabled when charging to get best performance at all times (given I don’t care about fan noise).

Applying this turned out to be easy with TLP using this config:

CPU_BOOST_ON_AC=1
CPU_BOOST_ON_BAT=0
2 Likes

One other thing you can consider is using a gnome extension to alter the frequency of the CPU and disable turbo boosting. If you know that it runs stable at 2800 Mhz then just set that as the max and min. That will lock the CPU at that frequency.

I can’t remember the name of the extension, but if you search the gnome extensions for cpu freq it’ll pop up.

Did you mean cpupower? I gave it a go, it does seem to set /sys/devices/system/cpu/intel_pstate/{min,max}_perf_pct correctly when I query with tlp-stat -p. However the CPU freq still varies in practice. I didn’t get any noticeable performance improvement by setting it to 100%/100% on discharge with no turbo i.e. 2700MHz.

I read an issue comment for TLP that suggests for Intel Core CPUs you cannot lock frequency, the CPU has final decision on what speed to run at. But this approach may work for other CPUs.