Skip to content

thermal: Rework binding cooling devices to trip points

Rafael J. Wysocki kernelci linux-amlogic linux-pm linux-samsung-soc lkml netdev platform-driver-x86 regressions 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest14 patches 51 repliesIn review
  2. v217 patches 5 repliesSuperseded
  3. v117 patches 9 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14thermal: core: Fold two functions into their respective callersdrivers/thermal/thermal_core.c+19 -362 replies
2/14thermal: core: Rearrange checks in thermal_bind_cdev_to_trip()drivers/thermal/thermal_core.c+4 -129 replies
3/14thermal: core: Drop redundant thermal instance checksdrivers/thermal/thermal_core.c+2 -25 replies
4/14thermal: sysfs: Use the dev argument in instance-related show/storedrivers/thermal/thermal_sysfs.c+7 -83 replies
5/14thermal: core: Move thermal zone locking out of bind/unbind functionsdrivers/acpi/thermal.c drivers/thermal/thermal_core.c+23 -96 replies
6/14thermal: core: Introduce .should_bind() thermal zone callbackdrivers/thermal/thermal_core.c include/linux/thermal.h+92 -243 replies
7/14thermal: ACPI: Use the .should_bind() thermal zone callbackdrivers/acpi/thermal.c+9 -552 replies
8/14thermal: core: Unexport thermal_bind_cdev_to_trip() and thermal_unbind_cdev_from_trip()drivers/thermal/thermal_core.c include/linux/thermal.h+4 -143 replies
9/14platform/x86: acerhdf: Use the .should_bind() thermal zone callbackdrivers/platform/x86/acerhdf.c+6 -272 replies
10/14mlxsw: core_thermal: Use the .should_bind() thermal zone callbackdrivers/net/ethernet/mellanox/mlxsw/core_thermal.c+31 -840 replies
11/14thermal: imx: Use the .should_bind() thermal zone callbackdrivers/thermal/imx_thermal.c+6 -141 reply
12/14thermal/of: Use the .should_bind() thermal zone callbackdrivers/thermal/thermal_of.c+41 -1305 replies
13/14thermal: core: Drop unused bind/unbind functions and callbacksDocumentation/driver-api/thermal/sysfs-api.rst drivers/thermal/thermal_core.c include/linux/thermal.h+6 -1383 replies
14/14thermal: core: Clean up trip bind/unbind functionsdrivers/thermal/thermal_core.c+21 -334 replies

Reviews trailers per patch

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

PatchIdo SchimmelHans de GoedePeter KästleZhang RuiHuisong LiDaniel Lezcano
1/14R-b R-b
2/14R-b R-b
3/14R-b R-b
4/14R-b A-b R-b
5/14R-b R-b
6/14R-b A-b R-b
7/14R-b R-b
8/14R-b A-b R-b
9/14A-b T-b R-b
10/14R-b
11/14R-b
12/14R-b T-b
13/14R-b A-b R-b
14/14R-b A-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 6 reviewers.

Read the v3 thread

Cover letter [PATCH v3 00/14] thermal: Rework binding cooling devices to trip points

Hi Everyone,

This is one more update of

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

the cover letter of which was sent separately by mistake:

https://lore.kernel.org/linux-pm/CAJZ5v0jo5vh2uD5t4GqBnN0qukMBG_ty33PB=NiEqigqxzBcsw@mail.gmail.com/

and it has been updated once already:

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

Relative to the v2 above it drops 3 patches, one because it was broken ([04/17 in the v2), and two more that would need to be rebased significantly, either because of dropping the other broken patch or because of the recent Bang-bang governor fixes:

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

The remaining 14 patches, 2 of which have been slightly rebased and the rest is mostly unchanged (except for some very minor subject and changelog fixes), is not expected to be controversial and are targeting 6.12, on top of the current linux-next material.

The original motivation for this series quoted below has not changed:

The code for binding cooling devices to trip points (and unbinding them from trip point) is one of the murkiest pieces of the thermal subsystem. It is convoluted, bloated with unnecessary code doing questionable things, and it works backwards.

The idea is to bind cooling devices to trip points in accordance with some information known to the thermal zone owner (thermal driver). This information is not known to the thermal core when the thermal zone is registered, so the driver needs to be involved, but instead of just asking the driver whether or not the given cooling device should be bound to a given trip point, the thermal core expects the driver to carry out all of the binding process including calling functions specifically provided by the core for this purpose which is cumbersome and counter-intuitive.

Because the driver has no information regarding the representation of the trip points at the core level, it is forced to walk them (and it has to avoid some locking traps while doing this), or it needs to make questionable assumptions regarding the ordering of the trips in the core. There are drivers doing both these things.

The first 5 patches in the series are preliminary.

Patch [06/14] introduces a new .should_bind() callback for thermal zones and patches [07,09-12/14] modifies drivers to use it instead of the .bind() and .unbind() callbacks which allows them to be simplified quite a bit.

The other patches [08,13-14/14] get rid of code that becomes unused after the previous changes and do some cleanups on top of that.

The entire series along with 2 patches on top of it (that were present in the v2 of this set of patches) is available in the thermal-core-testing git branch:

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

(note that this branch is going to be rebased shortly on top of 6.11-rc4 and the thermal control material in linux-next).

Thanks!