Message ID | 20230312204150.1353517-11-robdclark@gmail.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | drm/msm+PM+icc: Make job_run() reclaim-safe | expand |
On Sun, Mar 12, 2023 at 9:42 PM Rob Clark <robdclark@gmail.com> wrote: > > From: Rob Clark <robdclark@chromium.org> > > Annotate dev_pm_qos_mtx to teach lockdep to scream about allocations > that could trigger reclaim under dev_pm_qos_mtx. So why is this needed? > Signed-off-by: Rob Clark <robdclark@chromium.org> > --- > drivers/base/power/qos.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c > index 9cba334b3729..d4addda3944a 100644 > --- a/drivers/base/power/qos.c > +++ b/drivers/base/power/qos.c > @@ -1012,3 +1012,14 @@ void dev_pm_qos_hide_latency_tolerance(struct device *dev) > pm_runtime_put(dev); > } > EXPORT_SYMBOL_GPL(dev_pm_qos_hide_latency_tolerance); > + > +static int __init dev_pm_qos_init(void) > +{ > + /* Teach lockdep about lock ordering wrt. shrinker: */ > + fs_reclaim_acquire(GFP_KERNEL); > + might_lock(&dev_pm_qos_mtx); > + fs_reclaim_release(GFP_KERNEL); > + > + return 0; > +} > +early_initcall(dev_pm_qos_init); > -- > 2.39.2 >
On Mon, Mar 13, 2023 at 5:31 AM Rafael J. Wysocki <rafael@kernel.org> wrote: > > On Sun, Mar 12, 2023 at 9:42 PM Rob Clark <robdclark@gmail.com> wrote: > > > > From: Rob Clark <robdclark@chromium.org> > > > > Annotate dev_pm_qos_mtx to teach lockdep to scream about allocations > > that could trigger reclaim under dev_pm_qos_mtx. > > So why is this needed? Because it allows lockdep to warn about problems even if it hasn't seen recursion into shrinker yet. BR, -R > > Signed-off-by: Rob Clark <robdclark@chromium.org> > > --- > > drivers/base/power/qos.c | 11 +++++++++++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c > > index 9cba334b3729..d4addda3944a 100644 > > --- a/drivers/base/power/qos.c > > +++ b/drivers/base/power/qos.c > > @@ -1012,3 +1012,14 @@ void dev_pm_qos_hide_latency_tolerance(struct device *dev) > > pm_runtime_put(dev); > > } > > EXPORT_SYMBOL_GPL(dev_pm_qos_hide_latency_tolerance); > > + > > +static int __init dev_pm_qos_init(void) > > +{ > > + /* Teach lockdep about lock ordering wrt. shrinker: */ > > + fs_reclaim_acquire(GFP_KERNEL); > > + might_lock(&dev_pm_qos_mtx); > > + fs_reclaim_release(GFP_KERNEL); > > + > > + return 0; > > +} > > +early_initcall(dev_pm_qos_init); > > -- > > 2.39.2 > >
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index 9cba334b3729..d4addda3944a 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c @@ -1012,3 +1012,14 @@ void dev_pm_qos_hide_latency_tolerance(struct device *dev) pm_runtime_put(dev); } EXPORT_SYMBOL_GPL(dev_pm_qos_hide_latency_tolerance); + +static int __init dev_pm_qos_init(void) +{ + /* Teach lockdep about lock ordering wrt. shrinker: */ + fs_reclaim_acquire(GFP_KERNEL); + might_lock(&dev_pm_qos_mtx); + fs_reclaim_release(GFP_KERNEL); + + return 0; +} +early_initcall(dev_pm_qos_init);