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] [day] [month] [year] [list]
Date:   Mon, 3 Apr 2023 19:49:42 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Daniel Lezcano <daniel.lezcano@...aro.org>
Cc:     "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Linux PM <linux-pm@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Zhang Rui <rui.zhang@...el.com>,
        Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
Subject: Re: [PATCH v1] thermal: core: Clean up thermal_list_lock locking

On Sat, Apr 1, 2023 at 10:45 PM Daniel Lezcano
<daniel.lezcano@...aro.org> wrote:
>
> On 22/03/2023 20:34, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> >
> > Once thermal_list_lock has been acquired in
> > __thermal_cooling_device_register(), it is not necessary to drop it
> > and take it again until all of the thermal zones have been updated,
> > so change the code accordingly.
> >
> > No expected functional impact.
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> > ---
>
> Looks good to me, shall I pick it in my branch ?

No, I;ll take care of it myself, thanks!

> >   drivers/thermal/thermal_core.c |    8 ++------
> >   1 file changed, 2 insertions(+), 6 deletions(-)
> >
> > Index: linux-pm/drivers/thermal/thermal_core.c
> > ===================================================================
> > --- linux-pm.orig/drivers/thermal/thermal_core.c
> > +++ linux-pm/drivers/thermal/thermal_core.c
> > @@ -826,8 +826,6 @@ static void bind_cdev(struct thermal_coo
> >       const struct thermal_zone_params *tzp;
> >       struct thermal_zone_device *pos = NULL;
> >
> > -     mutex_lock(&thermal_list_lock);
> > -
> >       list_for_each_entry(pos, &thermal_tz_list, node) {
> >               if (!pos->tzp && !pos->ops->bind)
> >                       continue;
> > @@ -854,8 +852,6 @@ static void bind_cdev(struct thermal_coo
> >                              tzp->tbp[i].weight);
> >               }
> >       }
> > -
> > -     mutex_unlock(&thermal_list_lock);
> >   }
> >
> >   /**
> > @@ -933,17 +929,17 @@ __thermal_cooling_device_register(struct
> >
> >       /* Add 'this' new cdev to the global cdev list */
> >       mutex_lock(&thermal_list_lock);
> > +
> >       list_add(&cdev->node, &thermal_cdev_list);
> > -     mutex_unlock(&thermal_list_lock);
> >
> >       /* Update binding information for 'this' new cdev */
> >       bind_cdev(cdev);
> >
> > -     mutex_lock(&thermal_list_lock);
> >       list_for_each_entry(pos, &thermal_tz_list, node)
> >               if (atomic_cmpxchg(&pos->need_update, 1, 0))
> >                       thermal_zone_device_update(pos,
> >                                                  THERMAL_EVENT_UNSPECIFIED);
> > +
> >       mutex_unlock(&thermal_list_lock);
> >
> >       return cdev;
> >
> >
> >
>
> --
> <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