thermal: core: Restore behavior regarding invalid trip points
PATCH 1/1 thermal: core: Restore behavior regarding invalid trip points
Cited commit stopped marking trip points with a zero temperature as disabled, behavior that was originally introduced in commit 81ad4276b505 ("Thermal: Ignore invalid trip points").
When using the mlxsw driver we see that when such trip points are not disabled, the thermal subsystem repeatedly tries to set the state of the associated cooling devices to the maximum state.
Fix this by restoring the original behavior and mark trip points with a zero temperature as disabled.
--- drivers/thermal/thermal_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/thermal_core.c +1 -1
@@ -1309,7 +1309,7 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *tstruct thermal_trip trip; result =thermal_zone_get_trip (tz, count, &trip); -if (result) +if (result || !trip.temperature)set_bit (count, &tz->trips_disabled); }
Signature · 1 line
2.37.3
Rafael J. Wysocki
maintainerQuoted 11 lines · Ido Schimmel
Cited commit stopped marking trip points with a zero temperature as disabled, behavior that was originally introduced in commit
81ad4276b505("Thermal: Ignore invalid trip points").When using the mlxsw driver we see that when such trip points are not disabled, the thermal subsystem repeatedly tries to set the state of the associated cooling devices to the maximum state.
Fix this by restoring the original behavior and mark trip points with a zero temperature as disabled.
What if the temperature is negative? I think that you'd still want to disable the trip in that case, wouldn't you?
Daniel, what's your take on this?
Quoted 20 lines
Fixes 7c3d5c20dc16 ("thermal/core: Add a generic thermal_zone_get_trip() function")Signed-off-by Ido Schimmel <[email protected]>--- drivers/thermal/thermal_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/thermal/thermal_core.c +1
-2@@ -1309,7 +1309,7 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *tstruct thermal_trip trip; result =thermal_zone_get_trip (tz, count, &trip); -if (result) +if (result || !trip.temperature)set_bit (count, &tz->trips_disabled); } --
Hi Rafael,
Quoted 2 lines · Rafael J. Wysocki
What if the temperature is negative? I think that you'd still want to disable the trip in that case, wouldn't you?
Personally, no. This patch merely restores the behavior that was inadvertently removed by 7c3d5c20dc16. Specifically by this hunk:
```
@@ -1252,9 +1319,10 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t
goto release_device;
for (count = 0; count < num_trips; count++) {
- if (tz->ops->get_trip_type(tz, count, &trip_type) ||
- tz->ops->get_trip_temp(tz, count, &trip_temp) ||
- !trip_temp)
+ struct thermal_trip trip;
+
+ result = thermal_zone_get_trip(tz, count, &trip);
+ if (result)
set_bit(count, &tz->trips_disabled);
}
```Quoted 1 line
Daniel, what's your take on this?
Discussed this with Daniel yesterday:
https://lore.kernel.org/linux-pm/ZA8TPDpEVanOpjEp@shredder/
We agreed to rework mlxsw to not rely on the fact that trip points with a zero temperature are disabled, but it's not rc material, unlike this patch.
Thanks
Rafael J. Wysocki
maintainerQuoted 26 lines · Ido Schimmel
Hi Rafael,
Quoted 2 lines · Rafael J. Wysocki
What if the temperature is negative? I think that you'd still want to disable the trip in that case, wouldn't you?
Personally, no. This patch merely restores the behavior that was inadvertently removed by
7c3d5c20dc16. Specifically by this hunk:```
(quoted diff) +4
-3@@ -1252,9 +1319,10 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t goto release_device; for (count = 0; count < num_trips; count++) { - if (tz->ops->get_trip_type(tz, count, &trip_type) || - tz->ops->get_trip_temp(tz, count, &trip_temp) || - !trip_temp) + struct thermal_trip trip; + + result = thermal_zone_get_trip(tz, count, &trip); + if (result) set_bit(count, &tz->trips_disabled); }```
Quoted 8 lines
Quoted 1 line
Daniel, what's your take on this?
Discussed this with Daniel yesterday:
https://lore.kernel.org/linux-pm/ZA8TPDpEVanOpjEp@shredder/We agreed to rework mlxsw to not rely on the fact that trip points with a zero temperature are disabled, but it's not rc material, unlike this patch.
So I've applied this as 6.3-rc material for the sake of avoiding a driver regression in 6.3, under the assumption that we'll get the mlxsw driver update on time for the 6.4 merge window.
Thanks!
Quoted 3 lines · Rafael J. Wysocki
So I've applied this as 6.3-rc material for the sake of avoiding a driver regression in 6.3, under the assumption that we'll get the mlxsw driver update on time for the 6.4 merge window.
Correct. Sent the patches for internal review and will submit them to netdev (where this driver is maintained) next week assuming review is OK and nothing explodes in our regression. Will copy Daniel and you.
Thanks