public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: mandeep.baines@gmail.com
Cc: linux-kernel@vger.kernel.org,
	Mandeep Singh Baines <msb@chromium.org>,
	linux-pm@vger.kernel.org, stable@kernel.org,
	Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	Kevin Hilman <khilman@ti.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	Colin Cross <ccross@android.com>,
	Sameer Nanda <snanda@chromium.org>,
	Olof Johansson <olofj@chromium.org>
Subject: Re: [PATCH] PM: Prevent waiting forever on asynchronous suspend after abort
Date: Thu, 21 Jun 2012 22:43:28 +0200	[thread overview]
Message-ID: <201206212243.28984.rjw@sisk.pl> (raw)
In-Reply-To: <1340208795-8049-1-git-send-email-msb@chromium.org>

On Wednesday, June 20, 2012, mandeep.baines@gmail.com wrote:
> From: Mandeep Singh Baines <msb@chromium.org>
> 
> __device_suspend() must always send a completion. Otherwise, parent
> devices will wait forever.
> 
> Commit 1e2ef05b, "PM: Limit race conditions between runtime PM and
> system sleep (v2)", introduced a regression by short-circuiting the
> complete_all() for certain error cases.
> 
> This patch fixes the bug by always signalling a completion.
> 
> Addresses http://crosbug.com/31972
> 
> Tested by injecting an abort.
> 
> Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
> Cc: Rafael J. Wysocki <rjw@sisk.pl>
> Cc: linux-pm@vger.kernel.org
> Cc: stable@kernel.org
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: Len Brown <len.brown@intel.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Kevin Hilman <khilman@ti.com>
> Cc: Alan Stern <stern@rowland.harvard.edu>
> Cc: Colin Cross <ccross@android.com>
> Cc: Sameer Nanda <snanda@chromium.org>
> Cc: Olof Johansson <olofj@chromium.org>

Applied to linux-pm/linux-next, will be pushed to Linus in a couple of days.

Thanks,
Rafael


> ---
>  drivers/base/power/main.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> index e0fb5b0..9cb845e 100644
> --- a/drivers/base/power/main.c
> +++ b/drivers/base/power/main.c
> @@ -1031,7 +1031,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
>  	dpm_wait_for_children(dev, async);
>  
>  	if (async_error)
> -		return 0;
> +		goto Complete;
>  
>  	pm_runtime_get_noresume(dev);
>  	if (pm_runtime_barrier(dev) && device_may_wakeup(dev))
> @@ -1040,7 +1040,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
>  	if (pm_wakeup_pending()) {
>  		pm_runtime_put_sync(dev);
>  		async_error = -EBUSY;
> -		return 0;
> +		goto Complete;
>  	}
>  
>  	device_lock(dev);
> @@ -1097,6 +1097,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
>  	}
>  
>  	device_unlock(dev);
> +
> + Complete:
>  	complete_all(&dev->power.completion);
>  
>  	if (error) {
> 


  reply	other threads:[~2012-06-21 20:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20  2:17 [PATCH] PM: Prevent waiting forever on asynchronous suspend after abort Mandeep Singh Baines
2012-06-20 14:58 ` Alan Stern
2012-06-20 15:13   ` Greg Kroah-Hartman
2012-06-20 16:47   ` Mandeep Baines
2012-06-20 16:13 ` mandeep.baines
2012-06-21 20:43   ` Rafael J. Wysocki [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-06-20  2:08 Mandeep Singh Baines

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=201206212243.28984.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=ccross@android.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=khilman@ti.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mandeep.baines@gmail.com \
    --cc=msb@chromium.org \
    --cc=olofj@chromium.org \
    --cc=pavel@ucw.cz \
    --cc=snanda@chromium.org \
    --cc=stable@kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox