Skip to content

thermal: gov_bang_bang: Prevent cooling devices from getting stuck in the "on" state

Rafael J. Wysocki linux-pm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4thermal: gov_bang_bang: Call __thermal_cdev_update() directlydrivers/thermal/gov_bang_bang.c+1 -44 replies
2/4thermal: gov_bang_bang: Split bang_bang_control()drivers/thermal/gov_bang_bang.c+23 -192 replies
3/4thermal: gov_bang_bang: Add .manage() callbackdrivers/thermal/gov_bang_bang.c+30 -05 replies
4/4thermal: gov_bang_bang: Use governor_data to reduce overheaddrivers/thermal/gov_bang_bang.c drivers/thermal/thermal_core.c include/linux/thermal.h+21 -16 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchPeter KästleZhang Rui
1/4A-b R-b
2/4A-b R-b
3/4A-b A-b R-b
4/4A-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH v1 0/4] thermal: gov_bang_bang: Prevent cooling devices from getting stuck in the "on" state

Hi Everyone,

After changes made in 6.10, the Bang-bang governor has an initialization problem on systems where cooling devices start in the "on" state, but the thermal zone temperature stays below the corresponding trip points.

Namely, the Bang-bang governor only implements a .trip_crossed() callback which only runs when a trip point is crossed. If the zone temperature is always below the trip point, that callback will never be invoked. Now, if a cooling device bound to that trip point starts in the "on" state, the governor has no chance to change its state to "off".

This currently happens in the acerhdf driver, but it may as well happen elsewhere, so I think that it needs to be addressed in the thermal subsystem.

It can be addressed by adding a .manage() callback to the Bang-bang governor, which is done in patch [3/4]. That callback will be invoked every time __thermal_zone_device_update() runs, not just when a trip is crossed, so it can adjust the states of the cooling devices to the thermal zone temperature. However, after running once, it becomes a pure needless overhead because the states of cooling devices only need to be fixed up once (modulo some special situations like system resume).

That's addressed in patch [4/4] which uses governor_data to store the information on whether or not the states of the cooling devices will need to be adjusted.

Patches [1-2/4] are preliminary, but IMV it is better to make these changes separately for clarity, but also in case they turn out to have a functional effect which is not expected.

Overall, this series is a fix candidate for 6.11-rc because the change in behavior addressed by it can be regarded as a regression with respect to 6.9.

Unfortunately, it affects this series:

https://lore.kernel.org/linux-pm/[email protected]/

which will need to be reordered and rebased (slightly), but because I've dropped one broken patch from it already, it will need to be changed anyway.

Thanks!