linux-surface / linux-surface

Linux Kernel for Surface Devices
4.53k stars 202 forks source link

Governors missing? "Balanced" etc? #1382

Open tm-poc opened 2 months ago

tm-poc commented 2 months ago

I'm on a Surface Pro 9, x86. Rocking: 6.7.2-surface-1 as of this writing. And Ubuntu 22.04

I've found value in general to using tools to adjust my governor, change frequency limits, etc. Namely saving power, heat generation, and stuff like that.

I have noticed that when I use my governor management tool (a Gnome extension, forget the exact name) I only see two governors available... "Performance" and "Powersave". Both of which are useful for me, but the "Balanced" one, which I use regularly too, is absent from this computer (but I have it on other computers of other models/makes using the same Gnome extension).

So, does anyone know what's up with this? There are times I want Balanced, but not Power Save or Performance.

StollD commented 2 months ago

Governors are not generic, they are essentially presets implemented by a scaling driver. On x86, there are three relevant ones: acpi_pstate, intel_pstate and amd_pstate.

acpi_pstate is somewhat generic, and supports a range of governors, including powersave, performance and schedutil / ondemand (which I think is what "Balanced" in your extension refers to). The usefulness of powersave and performance is debatable, because (AFAIK) all it does is lock the CPU to the lowest or highest clock speed.

intel_pstate and amd_pstate are specialized implementations for some (newer) CPUs. Surfaces (with few exceptions) use Intel chips so I am going to focus on that.

intel_pstate only supports performance and powersave governors. However, unlike acpi_pstate, these don't control the clockspeed. Instead they set a power target on the CPU and let the boosting algorithms figure out the rest. Both governors should behave similar to ondemand or schedutil (so your balanced setting), except that setting the governor to performance will make them boost higher and faster.

If you want to learn more about frequency scaling of the CPU, the kernel documentation has an extensive entry about intel_pstate. The Arch Wiki should have some useful information too. You can also force the kernel to use acpi_pstate instead of intel_pstate, but I wouldn't really recommend that.

https://www.kernel.org/doc/html/latest/admin-guide/pm/intel_pstate.html