* [PATCH v1 0/2] thermal: A couple of minor governor fixes
@ 2024-01-15 17:52 Rafael J. Wysocki
2024-01-15 17:55 ` [PATCH v1 1/2] thermal: gov_fair_share: Fix dependency on trip points ordering Rafael J. Wysocki
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2024-01-15 17:52 UTC (permalink / raw)
To: Linux PM
Cc: LKML, Daniel Lezcano, Lukasz Luba, Srinivas Pandruvada, Zhang Rui
Hi Everyone,
As per the subject, the patches in this series fix a couple of relatively minor
issues in thermal governor (fair share and bang-bang).
Please refer to the patch changelogs for details.
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v1 1/2] thermal: gov_fair_share: Fix dependency on trip points ordering
2024-01-15 17:52 [PATCH v1 0/2] thermal: A couple of minor governor fixes Rafael J. Wysocki
@ 2024-01-15 17:55 ` Rafael J. Wysocki
2024-01-15 17:57 ` [PATCH v1 2/2] thermal: gov_bang_bang: Fix possible cooling device state ping-pong Rafael J. Wysocki
2024-01-29 14:36 ` [PATCH v1 0/2] thermal: A couple of minor governor fixes Rafael J. Wysocki
2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2024-01-15 17:55 UTC (permalink / raw)
To: Linux PM
Cc: LKML, Daniel Lezcano, Lukasz Luba, Srinivas Pandruvada, Zhang Rui
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
The computation in the fair share governor's get_trip_level() function
currently works under the assumption that the temperature ordering of
trips[] in a thermal zone is ascending, which need not be the case.
However, get_trip_level() can be made work regardless of whether or not
the trips table is ordered by temperature in any way, so change it
accordingly.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/thermal/gov_fair_share.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
Index: linux-pm/drivers/thermal/gov_fair_share.c
===================================================================
--- linux-pm.orig/drivers/thermal/gov_fair_share.c
+++ linux-pm/drivers/thermal/gov_fair_share.c
@@ -18,22 +18,24 @@
static int get_trip_level(struct thermal_zone_device *tz)
{
const struct thermal_trip *trip, *level_trip = NULL;
- int trip_level;
+ int trip_level = -1;
for_each_trip(tz, trip) {
if (trip->temperature >= tz->temperature)
- break;
+ continue;
- level_trip = trip;
+ trip_level++;
+
+ if (!level_trip || trip->temperature > level_trip->temperature)
+ level_trip = trip;
}
/* Bail out if the temperature is not greater than any trips. */
- if (!level_trip)
+ if (trip_level < 0)
return 0;
- trip_level = thermal_zone_trip_id(tz, level_trip);
-
- trace_thermal_zone_trip(tz, trip_level, level_trip->type);
+ trace_thermal_zone_trip(tz, thermal_zone_trip_id(tz, level_trip),
+ level_trip->type);
return trip_level;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v1 2/2] thermal: gov_bang_bang: Fix possible cooling device state ping-pong
2024-01-15 17:52 [PATCH v1 0/2] thermal: A couple of minor governor fixes Rafael J. Wysocki
2024-01-15 17:55 ` [PATCH v1 1/2] thermal: gov_fair_share: Fix dependency on trip points ordering Rafael J. Wysocki
@ 2024-01-15 17:57 ` Rafael J. Wysocki
2024-01-29 14:36 ` [PATCH v1 0/2] thermal: A couple of minor governor fixes Rafael J. Wysocki
2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2024-01-15 17:57 UTC (permalink / raw)
To: Linux PM
Cc: LKML, Daniel Lezcano, Lukasz Luba, Srinivas Pandruvada, Zhang Rui
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
The current behavior of thermal_zone_trip_update() in the bang-bang
thermal governor may be problematic for trip points with 0 hysteresis,
because when the zone temperature reaches the trip temperature and
stays there, it will then cause the cooling device go "on" and "off"
alternately, which is not desirable.
Address this by requiring the zone temperature to actually fall below
trip->temperature - trip->hysteresis for the cooling device to go off.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/thermal/gov_bang_bang.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-pm/drivers/thermal/gov_bang_bang.c
===================================================================
--- linux-pm.orig/drivers/thermal/gov_bang_bang.c
+++ linux-pm/drivers/thermal/gov_bang_bang.c
@@ -49,7 +49,7 @@ static int thermal_zone_trip_update(stru
if (instance->target == 0 && tz->temperature >= trip->temperature)
instance->target = 1;
else if (instance->target == 1 &&
- tz->temperature <= trip->temperature - trip->hysteresis)
+ tz->temperature < trip->temperature - trip->hysteresis)
instance->target = 0;
dev_dbg(&instance->cdev->device, "target=%d\n",
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 0/2] thermal: A couple of minor governor fixes
2024-01-15 17:52 [PATCH v1 0/2] thermal: A couple of minor governor fixes Rafael J. Wysocki
2024-01-15 17:55 ` [PATCH v1 1/2] thermal: gov_fair_share: Fix dependency on trip points ordering Rafael J. Wysocki
2024-01-15 17:57 ` [PATCH v1 2/2] thermal: gov_bang_bang: Fix possible cooling device state ping-pong Rafael J. Wysocki
@ 2024-01-29 14:36 ` Rafael J. Wysocki
2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2024-01-29 14:36 UTC (permalink / raw)
To: Linux PM
Cc: LKML, Daniel Lezcano, Lukasz Luba, Srinivas Pandruvada, Zhang Rui
On Mon, Jan 15, 2024 at 6:57 PM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>
> Hi Everyone,
>
> As per the subject, the patches in this series fix a couple of relatively minor
> issues in thermal governor (fair share and bang-bang).
>
> Please refer to the patch changelogs for details.
From the lack of feedback I gather that this is not controversial, so
I'm going to queue it up for 6.9.
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-29 14:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-15 17:52 [PATCH v1 0/2] thermal: A couple of minor governor fixes Rafael J. Wysocki
2024-01-15 17:55 ` [PATCH v1 1/2] thermal: gov_fair_share: Fix dependency on trip points ordering Rafael J. Wysocki
2024-01-15 17:57 ` [PATCH v1 2/2] thermal: gov_bang_bang: Fix possible cooling device state ping-pong Rafael J. Wysocki
2024-01-29 14:36 ` [PATCH v1 0/2] thermal: A couple of minor governor fixes Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).