Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 5290381

Browse files
committed
thermal: gov_step_wise: Go straight to instance->lower when mitigation is over
Commit b684682 ("thermal: gov_step_wise: Restore passive polling management") attempted to fix a Step-Wise thermal governor issue introduced by commit 042a3d8 ("thermal: core: Move passive polling management to the core"), which caused the governor to leave cooling devices in high states, by partially reverting that commit. However, this turns out to be insufficient on some systems due to interactions between the governor code restored by commit b684682 and the passive polling management in the thermal core. For this reason, revert commit b684682 and make the governor set the target cooling device state to the "lower" one as soon as the zone temperature falls below the threshold of the trip point corresponding to the given thermal instance, which means that thermal mitigation is not necessary any more. Before this change the "lower" cooling device state would be reached in steps through the passive polling mechanism which was questionable for three reasons: (1) cooling device were kept in high states when that was not necessary (and it could adversely impact performance), (2) it only worked for thermal zones with nonzero passive_delay_jiffies value, and (3) passive polling belongs to the core and should not be hijacked by governors for their internal purposes. Fixes: b684682 ("thermal: gov_step_wise: Restore passive polling management") Closes: https://lore.kernel.org/linux-pm/6759ce9f-281d-4fcd-bb4c-b784a1cc5f6e@oldschoolsolutions.biz Reported-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz> Tested-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz> Link: https://patch.msgid.link/12464461.O9o76ZdvQC@rjwysocki.net Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Steev Klimaszewski <steev@kali.org> Tested-by: Johan Hovold <johan+linaro@kernel.org>
1 parent f266106 commit 5290381

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

drivers/thermal/gov_step_wise.c

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ static unsigned long get_target_state(struct thermal_instance *instance,
5555
if (cur_state <= instance->lower)
5656
return THERMAL_NO_TARGET;
5757

58-
return clamp(cur_state - 1, instance->lower, instance->upper);
58+
/*
59+
* If 'throttle' is false, no mitigation is necessary, so
60+
* request the lower state for this instance.
61+
*/
62+
return instance->lower;
5963
}
6064

6165
return instance->target;
@@ -93,23 +97,6 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz,
9397
if (instance->initialized && old_target == instance->target)
9498
continue;
9599

96-
if (trip->type == THERMAL_TRIP_PASSIVE) {
97-
/*
98-
* If the target state for this thermal instance
99-
* changes from THERMAL_NO_TARGET to something else,
100-
* ensure that the zone temperature will be updated
101-
* (assuming enabled passive cooling) until it becomes
102-
* THERMAL_NO_TARGET again, or the cooling device may
103-
* not be reset to its initial state.
104-
*/
105-
if (old_target == THERMAL_NO_TARGET &&
106-
instance->target != THERMAL_NO_TARGET)
107-
tz->passive++;
108-
else if (old_target != THERMAL_NO_TARGET &&
109-
instance->target == THERMAL_NO_TARGET)
110-
tz->passive--;
111-
}
112-
113100
instance->initialized = true;
114101

115102
mutex_lock(&instance->cdev->lock);

0 commit comments

Comments
 (0)