[PATCH v1 00/16] thermal: core: Redesign the governor interface

From: Rafael J. Wysocki
Date: Wed Apr 10 2024 - 13:48:47 EST


Hi Everyone,

First off, apologies for the size of the series, but I couldn't resist
throwing a few cleanups in for a good measure.

To the point, this is based on two observations: (1) that the existing
throttle() governor callback is not really suitable or convenient for
any governors in the tree and (2) that the majority of governors in the
tree do not take trip hysteresis into account, although arguably they
should do that.

Point (1) is addressed by replacing the .throttle() callbacks with two
new governor callbacks, .trip_crossed() and .manage().

The first one will be invoked whenever a trip is crossed at the time when
the netlink messages are sent (so the ordering of these calls will be the
same as for the netlink messages). This is suitable for governors that
only care about trip crossing events, like Bang-Bang.

The other one will be invoked once per thermal zone update, after all of
the trips have been processed by the core, so the governors using it will
have to walk the trips by themselves, but they may also skip the trip
walk entirely if they don't need it, like the Power Allocator.

The .trip_crossed() callback is introduced in the first patch. Next, the
Banb-Bang governor is switched over to using it (instead of .throttle())
and cleaned up.

The .manage() callback is introduced subsequently (in patch [05/16]) and
the Power Allocator, Step-Wise and Fair-Share governors are made use it
instead of .throttle(), in this order. The latter two are then modified to
use trip point thresholds instead of trip temperatures, which they should
be doing. Still, all of the patches changing one governor are grouped
together.

Finally, the User Space governor is modified to use the .trip_crossed()
callback instead of .throttle() and the latter is dropped from the code
because it has no more users.

In addition, the handling of critical and hot trip points is relocated to
eliminate a redundant check.

Please refer to the individual patch changelogs for details.

The series is on top of the linux-next branch in linux-pm.git, which by now
should have been included into linux-next.

There is also a git branch where it can be found:

https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/log/?h=thermal-core-testing

Thanks!