[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1ad5743c-9405-9860-f835-6053f86b6590@linaro.org>
Date: Tue, 30 Jun 2020 13:58:45 +0200
From: Daniel Lezcano <daniel.lezcano@...aro.org>
To: Amit Kucheria <amit.kucheria@...aro.org>
Cc: Zhang Rui <rui.zhang@...el.com>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
Ram Chandrasekar <rkumbako@...eaurora.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 5/5] thermal: core: Add notifications call in the
framework
On 30/06/2020 13:49, Amit Kucheria wrote:
> On Thu, Jun 25, 2020 at 8:15 PM Daniel Lezcano
> <daniel.lezcano@...aro.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@...aro.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
Powered by blists - more mailing lists