Patch "thermal: gov_bang_bang: Adjust states of all uninitialized instances" has been added to the 6.10-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_bang_bang: Adjust states of all uninitialized instances

to the 6.10-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_bang_bang-adjust-states-of-all-uninitial.patch
and it can be found in the queue-6.10 subdirectory.

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



commit 60b643849b96ddeb2bbcd07d71ba04cbcc57d1cf
Author: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Date:   Mon Aug 26 18:23:49 2024 +0200

    thermal: gov_bang_bang: Adjust states of all uninitialized instances
    
    [ Upstream commit 15cb56bd529868d9242b22812fc69bd144bfdc94 ]
    
    If a cooling device is registered after a thermal zone it should be
    bound to and the trip point it should be bound to has already been
    crossed by the zone temperature on the way up, the cooling device's
    state may need to be adjusted, but the Bang-bang governor will not
    do that because its .manage() callback only looks at thermal instances
    for trip points whose thresholds are below or at the zone temperature.
    
    Address this by updating bang_bang_manage() to look at all of the
    uninitialized thermal instances and setting their target states in
    accordance with the position of the zone temperature with respect to
    the threshold of the given trip point.
    
    Fixes: 5f64b4a1ab1b ("thermal: gov_bang_bang: Add .manage() callback")
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
    Reviewed-by: Lukasz Luba <lukasz.luba@xxxxxxx>
    Link: https://patch.msgid.link/6103874.lOV4Wx5bFT@xxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c
index daed67d19efb8..863e7a4272e66 100644
--- a/drivers/thermal/gov_bang_bang.c
+++ b/drivers/thermal/gov_bang_bang.c
@@ -92,23 +92,21 @@ static void bang_bang_manage(struct thermal_zone_device *tz)
 
 	for_each_trip_desc(tz, td) {
 		const struct thermal_trip *trip = &td->trip;
+		bool turn_on;
 
-		if (tz->temperature >= td->threshold ||
-		    trip->temperature == THERMAL_TEMP_INVALID ||
+		if (trip->temperature == THERMAL_TEMP_INVALID ||
 		    trip->type == THERMAL_TRIP_CRITICAL ||
 		    trip->type == THERMAL_TRIP_HOT)
 			continue;
 
 		/*
-		 * If the initial cooling device state is "on", but the zone
-		 * temperature is not above the trip point, the core will not
-		 * call bang_bang_control() until the zone temperature reaches
-		 * the trip point temperature which may be never.  In those
-		 * cases, set the initial state of the cooling device to 0.
+		 * Adjust the target states for uninitialized thermal instances
+		 * to the thermal zone temperature and the trip point threshold.
 		 */
+		turn_on = tz->temperature >= td->threshold;
 		list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
 			if (!instance->initialized && instance->trip == trip)
-				bang_bang_set_instance_target(instance, 0);
+				bang_bang_set_instance_target(instance, turn_on);
 		}
 	}
 




[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