Patch "thermal: gov_power_allocator: avoid inability to reset a cdev" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    thermal: gov_power_allocator: avoid inability to reset a cdev

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     thermal-gov_power_allocator-avoid-inability-to-reset.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b785a8b6ba0dd845ecca179dc7f45ef3802a81a7
Author: Di Shen <di.shen@xxxxxxxxxx>
Date:   Wed Jan 10 19:55:26 2024 +0800

    thermal: gov_power_allocator: avoid inability to reset a cdev
    
    [ Upstream commit e95fa7404716f6e25021e66067271a4ad8eb1486 ]
    
    Commit 0952177f2a1f ("thermal/core/power_allocator: Update once
    cooling devices when temp is low") adds an update flag to avoid
    triggering a thermal event when there is no need, and the thermal
    cdev is updated once when the temperature is low.
    
    But when the trips are writable, and switch_on_temp is set to be a
    higher value, the cooling device state may not be reset to 0,
    because last_temperature is smaller than switch_on_temp.
    
    For example:
    First:
    switch_on_temp=70 control_temp=85;
    Then userspace change the trip_temp:
    switch_on_temp=45 control_temp=55 cur_temp=54
    
    Then userspace reset the trip_temp:
    switch_on_temp=70 control_temp=85 cur_temp=57 last_temp=54
    
    At this time, the cooling device state should be reset to 0.
    However, because cur_temp(57) < switch_on_temp(70)
    last_temp(54) < switch_on_temp(70)  ---->  update = false,
    update is false, the cooling device state can not be reset.
    
    Using the observation that tz->passive can also be regarded as the
    temperature status, set the update flag to the tz->passive value.
    
    When the temperature drops below switch_on for the first time, the
    states of cooling devices can be reset once, and tz->passive is updated
    to 0. In the next round, because tz->passive is 0, cdev->state will not
    be updated.
    
    By using the tz->passive value as the "update" flag, the issue above
    can be solved, and the cooling devices can be updated only once when the
    temperature is low.
    
    Fixes: 0952177f2a1f ("thermal/core/power_allocator: Update once cooling devices when temp is low")
    Cc: 5.13+ <stable@xxxxxxxxxxxxxxx> # 5.13+
    Suggested-by: Wei Wang <wvw@xxxxxxxxxx>
    Signed-off-by: Di Shen <di.shen@xxxxxxxxxx>
    Reviewed-by: Lukasz Luba <lukasz.luba@xxxxxxx>
    [ rjw: Subject and changelog edits ]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c
index 1faf55446ba2..fc969642f70b 100644
--- a/drivers/thermal/gov_power_allocator.c
+++ b/drivers/thermal/gov_power_allocator.c
@@ -715,7 +715,7 @@ static int power_allocator_throttle(struct thermal_zone_device *tz, int trip_id)
 
 	ret = __thermal_zone_get_trip(tz, params->trip_switch_on, &trip);
 	if (!ret && (tz->temperature < trip.temperature)) {
-		update = (tz->last_temperature >= trip.temperature);
+		update = tz->passive;
 		tz->passive = 0;
 		reset_pid_controller(params);
 		allow_maximum_power(tz, update);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux