From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Linux PM <linux-pm@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Ulf Hansson <ulf.hansson@linaro.org>
Subject: Re: [PATCH] PM: runtime: Add safety net to supplier device release
Date: Fri, 10 Dec 2021 17:17:18 +0100 [thread overview]
Message-ID: <YbN9jtlcKYG/WObw@kroah.com> (raw)
In-Reply-To: <11889065.O9o76ZdvQC@kreacher>
On Fri, Dec 10, 2021 at 05:10:13PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Because refcount_dec_not_one() returns true if the target refcount
> becomes saturated, it is generally unsafe to use its return value as
> a loop termination condition, but that is what happens when a device
> link's supplier device is released during runtime PM suspend
> operations and on device link removal.
>
> To address this, introduce pm_runtime_release_supplier() to be used
> in the above cases which will check the supplier device's runtime
> PM usage counter in addition to the refcount_dec_not_one() return
> value, so the loop can be terminated in case the rpm_active refcount
> value becomes invalid, and update the code in question to use it as
> appropriate.
>
> This change is not expected to have any visible functional impact.
>
> Reported-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/base/core.c | 3 +--
> drivers/base/power/runtime.c | 41 ++++++++++++++++++++++++++++++-----------
> include/linux/pm_runtime.h | 3 +++
> 3 files changed, 34 insertions(+), 13 deletions(-)
>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
next prev parent reply other threads:[~2021-12-10 16:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-10 16:10 [PATCH] PM: runtime: Add safety net to supplier device release Rafael J. Wysocki
2021-12-10 16:17 ` Greg Kroah-Hartman [this message]
2021-12-10 16:30 ` Peter Zijlstra
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=YbN9jtlcKYG/WObw@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rjw@rjwysocki.net \
--cc=ulf.hansson@linaro.org \
/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: link
Be 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.