From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Linux PM <linux-pm@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Lukasz Luba <lukasz.luba@arm.com>
Subject: Re: [PATCH v1] thermal: trip: Avoid skipping trips in thermal_zone_set_trips()
Date: Tue, 30 Jul 2024 16:57:21 +0200 [thread overview]
Message-ID: <4448b729-5998-440c-939e-08e719070ac5@linaro.org> (raw)
In-Reply-To: <12509184.O9o76ZdvQC@rjwysocki.net>
On 30/07/2024 16:41, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Say there are 3 trip points A, B, C sorted in ascending temperature
> order with no hysteresis. If the zone temerature is exactly equal to
> B, thermal_zone_set_trips() will set the boundaries to A and C and the
> hardware will not catch any crossing of B (either way) until either A
> or C is crossed and the boundaries are changed.
When the temperature is B, an interrupt fired which led to the
thermal_zone_update() and in turn it calls thermal_zone_set_trips()
As the current temperature is equal to trip B, it makes sense to set A
and C, as B has been processes when handling the thermal trips right
before calling thermal_zone_set_trips()
I'm failing to understand the issue you describe
Were you able to reproduce the issue with emul_temp ?
> To avoid that, use non-strict inequalities when comparing the trip
> threshold to the zone temperature in thermal_zone_set_trips().
>
> In the example above, it will cause both boundaries to be set to B,
> which is desirable because an interrupt will trigger when the zone
> temperature becomes different from B regardless of which way it goes.
> That will allow a new interval to be set depending on the direction of
> the zone temperature change.
>
> Fixes: 893bae92237d ("thermal: trip: Make thermal_zone_set_trips() use trip thresholds")
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>
> 6.11-rc material.
>
> ---
> drivers/thermal/thermal_trip.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> Index: linux-pm/drivers/thermal/thermal_trip.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_trip.c
> +++ linux-pm/drivers/thermal/thermal_trip.c
> @@ -82,10 +82,10 @@ void thermal_zone_set_trips(struct therm
> return;
>
> for_each_trip_desc(tz, td) {
> - if (td->threshold < tz->temperature && td->threshold > low)
> + if (td->threshold <= tz->temperature && td->threshold > low)
> low = td->threshold;
>
> - if (td->threshold > tz->temperature && td->threshold < high)
> + if (td->threshold >= tz->temperature && td->threshold < high)
> high = td->threshold;
> }
>
>
>
>
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
next prev parent reply other threads:[~2024-07-30 14:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-30 14:41 Rafael J. Wysocki
2024-07-30 14:57 ` Daniel Lezcano [this message]
2024-07-30 16:46 ` Rafael J. Wysocki
2024-07-30 20:17 ` Rafael J. Wysocki
2024-07-31 10:08 ` Daniel Lezcano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4448b729-5998-440c-939e-08e719070ac5@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®