[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0gdBC+zEADs52GnR55Df8gPwG=CF5K_2SRrtoYQXZ-DxA@mail.gmail.com>
Date: Tue, 27 Apr 2021 15:22:39 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Johan Hovold <johan@...nel.org>,
Julia Lawall <Julia.Lawall@...ia.fr>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
kernel-janitors@...r.kernel.org,
Gilles Muller <Gilles.Muller@...ia.fr>,
Nicolas Palix <nicolas.palix@...g.fr>,
Michal Marek <michal.lkml@...kovi.net>, cocci@...teme.lip6.fr,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] coccinelle: api: semantic patch to use pm_runtime_resume_and_get
On Tue, Apr 27, 2021 at 3:18 PM Johan Hovold <johan@...nel.org> wrote:
>
> On Mon, Apr 26, 2021 at 08:54:04PM +0200, Julia Lawall wrote:
> > pm_runtime_get_sync keeps a reference count on failure, which can lead
> > to leaks. pm_runtime_resume_and_get drops the reference count in the
> > failure case. This rule very conservatively follows the definition of
> > pm_runtime_resume_and_get to address the cases where the reference
> > count is unlikely to be needed in the failure case.
> >
> > pm_runtime_resume_and_get was introduced in
> > commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to
> > deal with usage counter")
> >
> > Signed-off-by: Julia Lawall <Julia.Lawall@...ia.fr>
>
> As I've said elsewhere, not sure trying to do a mass conversion of this
> is a good idea.
No, it isn't.
> People may not be used to the interface, but it is
> consistent and has its use. The recent flurry of conversions show that
> those also risk introducing new bugs in code that is currently tested
> and correct.
>
> By giving the script kiddies another toy like this, the influx of broken
> patches is just bound to increase.
>
> Would also be good to CC the PM maintainer on this issue.
There are many call sites in the kernel where replacing
pm_runtime_get_sync() with pm_runtime_resume_and_get() mechanically
would introduce an error, so please don't do that.
Every such replacement should be reviewed by the people familiar with
the code in question.
Thanks,
Rafael
Powered by blists - more mailing lists