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, 21 Mar 2023 20:43:49 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Zhang Rui <rui.zhang@...el.com>
Cc:     linux-pm@...r.kernel.org, rafael.j.wysocki@...el.com,
        daniel.lezcano@...aro.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] thermal/core: update cooling device during thermal zone unregistration

On Tue, Mar 21, 2023 at 4:46 PM Zhang Rui <rui.zhang@...el.com> wrote:
>
> When unregistering a thermal zone device, update the cooling device in
> case the cooling device is activated by the current thermal zone.

I think that all cooling devices bound to the thermal zone being
removed need to be updated at this point?  Which is what the patch
really does IIUC.

It also avoids unbinding cooling devices that have not been bound to that zone.

> This fixes a problem that the frequency of ACPI processors are still
> limited after unloading ACPI thermal driver while ACPI passive cooling
> is activated.
>

Cc: stable@...r ?

> Signed-off-by: Zhang Rui <rui.zhang@...el.com>
> ---
>  drivers/thermal/thermal_core.c | 26 +++++++++++++++++++++++++-
>  1 file changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index cfd4c1afeae7..9f120e3c9bf0 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -1477,6 +1477,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
>         const struct thermal_zone_params *tzp;
>         struct thermal_cooling_device *cdev;
>         struct thermal_zone_device *pos = NULL;
> +       struct thermal_instance *ti;
>
>         if (!tz)
>                 return;
> @@ -1497,9 +1498,22 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
>

I would rearrange the code as follows.

>         /* Unbind all cdevs associated with 'this' thermal zone */
>         list_for_each_entry(cdev, &thermal_cdev_list, node) {
                    struct thermal_instance *ti;

> +               mutex_lock(&tz->lock);
> +               list_for_each_entry(ti, &tz->thermal_instances, tz_node) {

                            if (ti->cdev == cdev) {
                                    mutex_unlock(&tz->lock);
                                    goto unbind;
                            }
                    }
                    /* The cooling device is not used by this thermal zone. */
                    mutex_unlock(&tz->lock);
                    continue;

unbind:

>                 if (tz->ops->unbind) {
>                         tz->ops->unbind(tz, cdev);

                            /*
                             * The thermal instance for current
thermal zone has been
                             * removed, so update the cooling device
in case it has been
                             * activated by the thermal zone device going away.
                             */
                            mutex_lock(&cdev->lock);
                            __thermal_cdev_update(cdev);
                            mutex_unlock(&cdev->lock);

                            continue;
>                 }
>
>                 if (!tzp || !tzp->tbp)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ