On 22 May 2018 at 13:02, Rafael J. Wysocki <[email protected]> wrote:
> From: Rafael J. Wysocki <[email protected]>
>
> Commit 08810a4119aa (PM / core: Add NEVER_SKIP and SMART_PREPARE
> driver flags) inadvertently prevented the power.direct_complete flag
> from being set for devices without PM callbacks and with disabled
> runtime PM which also prevents power.direct_complete from being set
> for their parents.  That led to problems including a resume crash on
> HP ZBook 14u.
>
> Restore the previous behavior by causing power.direct_complete to be
> set for those devices again, but do that in a more direct way to
> avoid overlooking that case in the future.
>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=199693
> Fixes: 08810a4119aa (PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags)
> Reported-by: Thomas Martitz <[email protected]>
> Tested-by: Thomas Martitz <[email protected]>
> Signed-off-by: Rafael J. Wysocki <[email protected]>

It seems like the resume path of HP ZBook 14u is kind of fragile, in
case it *requires* dev->power.direct_complete to be set for devices
like these. And that makes me wonder, that perhaps we should try to
address that issue as well, no?

In either way:

Reviewed-by: Ulf Hansson <[email protected]>

Kind regards
Uffe

> ---
>  drivers/base/power/main.c |    7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> Index: linux-pm/drivers/base/power/main.c
> ===================================================================
> --- linux-pm.orig/drivers/base/power/main.c
> +++ linux-pm/drivers/base/power/main.c
> @@ -1920,10 +1920,8 @@ static int device_prepare(struct device
>
>         dev->power.wakeup_path = false;
>
> -       if (dev->power.no_pm_callbacks) {
> -               ret = 1;        /* Let device go direct_complete */
> +       if (dev->power.no_pm_callbacks)
>                 goto unlock;
> -       }
>
>         if (dev->pm_domain)
>                 callback = dev->pm_domain->ops.prepare;
> @@ -1957,7 +1955,8 @@ unlock:
>          */
>         spin_lock_irq(&dev->power.lock);
>         dev->power.direct_complete = state.event == PM_EVENT_SUSPEND &&
> -               pm_runtime_suspended(dev) && ret > 0 &&
> +               ((pm_runtime_suspended(dev) && ret > 0) ||
> +                dev->power.no_pm_callbacks) &&
>                 !dev_pm_test_driver_flags(dev, DPM_FLAG_NEVER_SKIP);
>         spin_unlock_irq(&dev->power.lock);
>         return 0;
>

Reply via email to