[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0grG7eSJ7_c73i9-bXaFhm5rfE2WmxtR6yLB-MGkd7sVg@mail.gmail.com>
Date: Wed, 4 Dec 2024 13:53:36 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Saravana Kannan <saravanak@...gle.com>
Cc: Pavel Machek <pavel@....cz>, Len Brown <len.brown@...el.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Ben Segall <bsegall@...gle.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>, kernel-team@...roid.com, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/5] PM: sleep: Fix runtime PM issue in dpm_resume()
Trim CC list.
On Thu, Nov 14, 2024 at 11:09 PM Saravana Kannan <saravanak@...gle.com> wrote:
>
> Some devices might have their is_suspended flag set to false. In these
> cases, dpm_resume() should skip doing anything for those devices.
Not really. This is particularly untrue for devices with
power.direct_complete set that have power.is_suspended clear.
> However, runtime PM enable and a few others steps are done before
> checking for this flag. Fix it so that we do things in the right order.
I don't see the bug this is fixing, but I can see bugs introduced by it.
I think that you want power.is_suspended to be checked before waiting
for the superiors. Fair enough, since for devices with
power.is_suspended clear, there should be no superiors to wait for, so
the two checks can be done in any order and checking
power.is_suspended first would be less overhead. And that's it
AFAICS.
> Signed-off-by: Saravana Kannan <saravanak@...gle.com>
> ---
> drivers/base/power/main.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> index 4a67e83300e1..86e51b9fefab 100644
> --- a/drivers/base/power/main.c
> +++ b/drivers/base/power/main.c
> @@ -913,6 +913,9 @@ static void device_resume(struct device *dev, pm_message_t state, bool async)
> if (dev->power.syscore)
> goto Complete;
>
> + if (!dev->power.is_suspended)
> + goto Unlock;
> +
> if (dev->power.direct_complete) {
> /* Match the pm_runtime_disable() in __device_suspend(). */
> pm_runtime_enable(dev);
> @@ -931,9 +934,6 @@ static void device_resume(struct device *dev, pm_message_t state, bool async)
> */
> dev->power.is_prepared = false;
>
> - if (!dev->power.is_suspended)
> - goto Unlock;
> -
> if (dev->pm_domain) {
> info = "power domain ";
> callback = pm_op(&dev->pm_domain->ops, state);
> --
> 2.47.0.338.g60cca15819-goog
>
Powered by blists - more mailing lists