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]
Message-ID: <CAJZ5v0ibt6nj6+E3onu4Ri74gX84VBob-hOWQPZiusGKb_Apjw@mail.gmail.com>
Date:   Mon, 26 Sep 2022 21:34:12 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Daniel Lezcano <daniel.lezcano@...aro.org>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        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 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?

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?

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ