lkml.org 
[lkml]   [2020]   [Jun]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 5/5] thermal: core: Add notifications call in the framework
From
Date
On 30/06/2020 13:49, Amit Kucheria wrote:
> On Thu, Jun 25, 2020 at 8:15 PM Daniel Lezcano
> <daniel.lezcano@linaro.org> wrote:
>>
>> The generic netlink protocol is implemented but the different
>> notification functions are not yet connected to the core code.
>>
>> These changes add the notification calls in the different
>> corresponding places.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> ---
>> drivers/thermal/thermal_core.c | 21 +++++++++++++++++++++
>> drivers/thermal/thermal_helpers.c | 11 +++++++++--
>> drivers/thermal/thermal_sysfs.c | 15 ++++++++++++++-
>> 3 files changed, 44 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
>> index 58c95aeafb7f..1388c03d1190 100644
>> --- a/drivers/thermal/thermal_core.c
>> +++ b/drivers/thermal/thermal_core.c
>> @@ -215,6 +215,8 @@ int thermal_zone_device_set_policy(struct thermal_zone_device *tz,
>> mutex_unlock(&tz->lock);
>> mutex_unlock(&thermal_governor_lock);
>>
>> + thermal_notify_tz_gov_change(tz->id, policy);
>> +
>> return ret;
>> }
>>
>> @@ -406,12 +408,25 @@ static void handle_critical_trips(struct thermal_zone_device *tz,
>> static void handle_thermal_trip(struct thermal_zone_device *tz, int trip)
>> {
>> enum thermal_trip_type type;
>> + int trip_temp, hyst = 0;
>>
>> /* Ignore disabled trip points */
>> if (test_bit(trip, &tz->trips_disabled))
>> return;
>>
>> + tz->ops->get_trip_temp(tz, trip, &trip_temp);
>> tz->ops->get_trip_type(tz, trip, &type);
>> + if (tz->ops->get_trip_hyst)
>> + tz->ops->get_trip_hyst(tz, trip, &hyst);
>> +
>> + if (tz->last_temperature != THERMAL_TEMP_INVALID) {
>> + if (tz->last_temperature < trip_temp &&
>> + tz->temperature >= trip_temp)
>> + thermal_notify_tz_trip_up(tz->id, trip);
>> + if (tz->last_temperature >= trip_temp &&
>> + tz->temperature < (trip_temp - hyst))
>> + thermal_notify_tz_trip_down(tz->id, trip);
>> + }
>>
>> if (type == THERMAL_TRIP_CRITICAL || type == THERMAL_TRIP_HOT)
>> handle_critical_trips(tz, trip, type);
>> @@ -443,6 +458,8 @@ static void update_temperature(struct thermal_zone_device *tz)
>> mutex_unlock(&tz->lock);
>>
>> trace_thermal_temperature(tz);
>> +
>> + thermal_genl_sampling_temp(tz->id, temp);
>
> Does this need any rate limiting? How many times is update_temperature
> called on a platform with a dozen sensors?

Assuming they are all in polling mode, it is dozen messages average per
second.

If *all* sensors are doing passive cooling with 100ms, then it is around
120 messages per second in the very worst case (fast polling, all above
the trip point).

We do not need any rate limiting ATM. If we reach this limit in the
future we can improve the notification.



--
<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

\
 
 \ /
  Last update: 2020-06-30 13:59    [W:0.055 / U:32.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site