[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0i_Z43bLWsa9gg_SZFBURi1XrZn4Cnxurm8KCawAWqtUA@mail.gmail.com>
Date: Tue, 20 Aug 2024 12:27:29 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: "lihuisong (C)" <lihuisong@...wei.com>
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>, Linux PM <linux-pm@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>, Daniel Lezcano <daniel.lezcano@...aro.org>,
Lukasz Luba <lukasz.luba@....com>, Zhang Rui <rui.zhang@...el.com>
Subject: Re: [PATCH v3 05/14] thermal: core: Move thermal zone locking out of
bind/unbind functions
On Tue, Aug 20, 2024 at 10:27 AM lihuisong (C) <lihuisong@...wei.com> wrote:
>
>
> 在 2024/8/19 23:58, Rafael J. Wysocki 写道:
> > From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> >
> > Since thermal_bind_cdev_to_trip() and thermal_unbind_cdev_from_trip()
> > acquire the thermal zone lock, the locking rules for their callers get
> > complicated. In particular, the thermal zone lock cannot be acquired
> > in any code path leading to one of these functions even though it might
> > be useful to do so.
> >
> > To address this, remove the thermal zone locking from both these
> > functions, add lockdep assertions for the thermal zone lock to both
> > of them and make their callers acquire the thermal zone lock instead.
> >
> > No intentional functional impact.
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> > ---
> >
> > v2 -> v3: Rebase after dropping patches [04-05/17] from the series
> >
> > v1 -> v2: No changes
> >
> > ---
> > drivers/acpi/thermal.c | 2 +-
> > drivers/thermal/thermal_core.c | 30 ++++++++++++++++++++++--------
> > 2 files changed, 23 insertions(+), 9 deletions(-)
> >
> > Index: linux-pm/drivers/thermal/thermal_core.c
> > ===================================================================
> > --- linux-pm.orig/drivers/thermal/thermal_core.c
> > +++ linux-pm/drivers/thermal/thermal_core.c
> > @@ -785,6 +785,7 @@ int thermal_bind_cdev_to_trip(struct the
> > int result;
> >
> <snip>
> >
> > Index: linux-pm/drivers/acpi/thermal.c
> > ===================================================================
> > --- linux-pm.orig/drivers/acpi/thermal.c
> > +++ linux-pm/drivers/acpi/thermal.c
> > @@ -609,7 +609,7 @@ static int acpi_thermal_bind_unbind_cdev
> > .thermal = thermal, .cdev = cdev, .bind = bind
> > };
> >
> > - return for_each_thermal_trip(thermal, bind_unbind_cdev_cb, &bd);
> > + return thermal_zone_for_each_trip(thermal, bind_unbind_cdev_cb, &bd);
> If so, it seems that the for_each_thermal_trip() can be removed or no
> need to export.
I beg to differ:
$ git grep for_each_thermal_trip | head -1
drivers/net/wireless/intel/iwlwifi/mvm/tt.c:
for_each_thermal_trip(mvm->tz_device.tzone, iwl_trip_temp_cb, &twd);
Powered by blists - more mailing lists