From: Johan Hovold <johan@kernel.org> To: Julia Lawall <Julia.Lawall@inria.fr> Cc: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>, Mauro Carvalho Chehab <mchehab+huawei@kernel.org>, kernel-janitors@vger.kernel.org, Gilles Muller <Gilles.Muller@inria.fr>, Nicolas Palix <nicolas.palix@imag.fr>, Michal Marek <michal.lkml@markovi.net>, cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org, "Rafael J . Wysocki" <rafael@kernel.org>, Zhang Qilong <zhangqilong3@huawei.com>, Jakub Kicinski <kuba@kernel.org> Subject: Re: [PATCH v3] coccinelle: api: semantic patch to use pm_runtime_resume_and_get Date: Tue, 27 Apr 2021 17:05:28 +0200 [thread overview] Message-ID: <YIgoOH04vO3KPSBs@hovoldconsulting.com> (raw) In-Reply-To: <20210427125834.2477467-1-Julia.Lawall@inria.fr> On Tue, Apr 27, 2021 at 02:58:34PM +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. Specifically, the > change is only done when pm_runtime_get_sync is followed immediately > by an if and when the branch of the if is immediately a call to > pm_runtime_put_noidle (like in the definition of > pm_runtime_resume_and_get) or something that is likely a print > statement followed by a pm_runtime_resume_and_get call. The patch s/pm_runtime_resume_and_get/pm_runtime_put_noidle/ > case appears somewhat more complicated, because it also deals with the > cases where {}s need to be removed. > > 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@inria.fr> > > --- > v3: add the people who signed off on commit dd8088d5a896, expand the log message > v2: better keyword Johan
WARNING: multiple messages have this Message-ID (diff)
From: Johan Hovold <johan@kernel.org> To: Julia Lawall <Julia.Lawall@inria.fr> Cc: Michal Marek <michal.lkml@markovi.net>, Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>, Mauro Carvalho Chehab <mchehab+huawei@kernel.org>, kernel-janitors@vger.kernel.org, Zhang Qilong <zhangqilong3@huawei.com>, "Rafael J . Wysocki" <rafael@kernel.org>, Nicolas Palix <nicolas.palix@imag.fr>, linux-kernel@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>, cocci@systeme.lip6.fr Subject: Re: [Cocci] [PATCH v3] coccinelle: api: semantic patch to use pm_runtime_resume_and_get Date: Tue, 27 Apr 2021 17:05:28 +0200 [thread overview] Message-ID: <YIgoOH04vO3KPSBs@hovoldconsulting.com> (raw) In-Reply-To: <20210427125834.2477467-1-Julia.Lawall@inria.fr> On Tue, Apr 27, 2021 at 02:58:34PM +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. Specifically, the > change is only done when pm_runtime_get_sync is followed immediately > by an if and when the branch of the if is immediately a call to > pm_runtime_put_noidle (like in the definition of > pm_runtime_resume_and_get) or something that is likely a print > statement followed by a pm_runtime_resume_and_get call. The patch s/pm_runtime_resume_and_get/pm_runtime_put_noidle/ > case appears somewhat more complicated, because it also deals with the > cases where {}s need to be removed. > > 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@inria.fr> > > --- > v3: add the people who signed off on commit dd8088d5a896, expand the log message > v2: better keyword Johan _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
next prev parent reply other threads:[~2021-04-27 15:05 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-27 12:58 [PATCH v3] coccinelle: api: semantic patch to use pm_runtime_resume_and_get Julia Lawall 2021-04-27 12:58 ` [Cocci] " Julia Lawall 2021-04-27 13:54 ` Rafael J. Wysocki 2021-04-27 13:54 ` [Cocci] " Rafael J. Wysocki 2021-04-27 15:05 ` Johan Hovold [this message] 2021-04-27 15:05 ` Johan Hovold
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=YIgoOH04vO3KPSBs@hovoldconsulting.com \ --to=johan@kernel.org \ --cc=Gilles.Muller@inria.fr \ --cc=Julia.Lawall@inria.fr \ --cc=cocci@systeme.lip6.fr \ --cc=kernel-janitors@vger.kernel.org \ --cc=krzysztof.kozlowski@canonical.com \ --cc=kuba@kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mchehab+huawei@kernel.org \ --cc=michal.lkml@markovi.net \ --cc=nicolas.palix@imag.fr \ --cc=rafael@kernel.org \ --cc=zhangqilong3@huawei.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.