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: <CAJZ5v0hApA+fnuRmT_xDdJiqmkGfrfku=8rNG7G_YohGYZm5nw@mail.gmail.com>
Date:   Thu, 30 Dec 2021 17:09:47 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Manaf Meethalavalappu Pallikunhi <quic_manafm@...cinc.com>
Cc:     "Rafael J . Wysocki" <rafael@...nel.org>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Amit Kucheria <amitk@...nel.org>,
        Zhang Rui <rui.zhang@...el.com>,
        Thara Gopinath <thara.gopinath@...aro.org>,
        Matthias Kaehlcke <mka@...omium.org>,
        Linux PM <linux-pm@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] thermal/core: Clear all mitigation when thermal zone
 is disabled

On Wed, Dec 29, 2021 at 8:03 AM Manaf Meethalavalappu Pallikunhi
<quic_manafm@...cinc.com> wrote:
>
> Whenever a thermal zone is in trip violated state, there is a chance
> that the same thermal zone mode can be disabled either via thermal
> core API or via thermal zone sysfs. Once it is disabled, the framework
> bails out any re-evaluation of thermal zone. It leads to a case where
> if it is already in mitigation state, it will stay the same state
> until it is re-enabled.

You seem to be arguing that disabling a thermal zone should prevent it
from throttling anything, which is reasonable, but I'm not sure if the
change below is sufficient for that.

> To avoid above mentioned issue, on thermal zone disable request
> reset thermal zone and clear mitigation for each trip explicitly.
>
> Signed-off-by: Manaf Meethalavalappu Pallikunhi <quic_manafm@...cinc.com>
> ---
>  drivers/thermal/thermal_core.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index 51374f4..5f4e35b 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -427,6 +427,7 @@ static int thermal_zone_device_set_mode(struct thermal_zone_device *tz,
>                                         enum thermal_device_mode mode)
>  {
>         int ret = 0;
> +       int trip;

This can be declared in the block in which it is used.

>
>         mutex_lock(&tz->lock);
>
> @@ -449,8 +450,14 @@ static int thermal_zone_device_set_mode(struct thermal_zone_device *tz,
>
>         if (mode == THERMAL_DEVICE_ENABLED)

The coding style asks for braces here if they are used after the else.

>                 thermal_notify_tz_enable(tz->id);
> -       else
> +       else {
> +               /* make sure all previous throttlings are cleared */
> +               thermal_zone_device_init(tz);
> +               for (trip = 0; trip < tz->trips; trip++)
> +                       handle_thermal_trip(tz, trip);

So I'm not sure if this makes the throttling go away in all cases (eg.
what if the current temperature is still above the given trip at this
point?).

> +
>                 thermal_notify_tz_disable(tz->id);
> +       }
>
>         return ret;
>  }
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ