lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 27 Sep 2022 00:15:46 +0200
From:   Daniel Lezcano <daniel.lezcano@...aro.org>
To:     "Rafael J. Wysocki" <rafael@...nel.org>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux PM <linux-pm@...r.kernel.org>,
        "Zhang, Rui" <rui.zhang@...el.com>,
        Lukasz Luba <lukasz.luba@....com>,
        Amit Kucheria <amitk@...nel.org>
Subject: Re: [PATCH v5 05/30] thermal/core/governors: Use
 thermal_zone_get_trip() instead of ops functions

On 26/09/2022 21:34, Rafael J. Wysocki wrote:
> On Mon, Sep 26, 2022 at 4:06 PM Daniel Lezcano
> <daniel.lezcano@...aro.org> wrote:
>>
>> The governors are using the ops->get_trip_* functions, Replace these
>> calls with thermal_zone_get_trip().
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@...aro.org>
>> Reviewed-by: Zhang Rui <rui.zhang@...el.com>
>> Reviewed-by: Lukasz Luba <lukasz.luba@....com> # IPA
>> ---
>>   drivers/thermal/gov_bang_bang.c       | 29 ++++++++-------
>>   drivers/thermal/gov_fair_share.c      | 18 ++++------
>>   drivers/thermal/gov_power_allocator.c | 51 ++++++++++++---------------
>>   drivers/thermal/gov_step_wise.c       | 22 ++++++------
>>   4 files changed, 53 insertions(+), 67 deletions(-)
>>
>> diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c
>> index a08bbe33be96..f5b85e5ea707 100644
>> --- a/drivers/thermal/gov_bang_bang.c
>> +++ b/drivers/thermal/gov_bang_bang.c
>> @@ -13,26 +13,25 @@
>>
>>   #include "thermal_core.h"
>>
>> -static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
>> +static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id)
>>   {
>> -       int trip_temp, trip_hyst;
>> +       struct thermal_trip trip;
>>          struct thermal_instance *instance;
>> +       int ret;
>>
>> -       tz->ops->get_trip_temp(tz, trip, &trip_temp);
>> -
>> -       if (!tz->ops->get_trip_hyst) {
>> -               pr_warn_once("Undefined get_trip_hyst for thermal zone %s - "
>> -                               "running with default hysteresis zero\n", tz->type);
>> -               trip_hyst = 0;
>> -       } else
>> -               tz->ops->get_trip_hyst(tz, trip, &trip_hyst);
>> +       ret = __thermal_zone_get_trip(tz, trip_id, &trip);
>> +       if (ret)
>> +               pr_warn_once("Failed to retrieve trip point %d\n", trip_id);
> 
> Does it even make sense to continue beyond this point if ret is nonzero?

No, I think we can bail out from here

> All of the contents of trip can be garbage then AFAICS.
> 
>> +
>> +       if (!trip.hysteresis)
>> +               pr_warn_once("Zero hysteresis value for thermal zone %s\n", tz->type);
> 
> Why do you want to warn about this?  Haven't we declared already that
> zero hysteresis is valid and normal?

Apparently the bang-bang governor is expecting a hysteresis value as the 
check is expecting:

 >> -       if (!tz->ops->get_trip_hyst) {
 >> -               pr_warn_once("Undefined get_trip_hyst for thermal 
zone %s - "
 >> -                               "running with default hysteresis 
zero\n", tz->type);
 >> -               trip_hyst = 0;

It is just to keep a warning as before.

>>
>>          dev_dbg(&tz->device, "Trip%d[temp=%d]:temp=%d:hyst=%d\n",
>> -                               trip, trip_temp, tz->temperature,
>> -                               trip_hyst);
>> +                               trip_id, trip.temperature, tz->temperature,
>> +                               trip.hysteresis);
>>
>>          list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
>> -               if (instance->trip != trip)
>> +               if (instance->trip != trip_id)
>>                          continue;
>>
>>                  /* in case fan is in initial state, switch the fan off */


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

Powered by Openwall GNU/*/Linux Powered by OpenVZ