On Wed, 2012-04-11 at 16:11 -0700, Greg KH wrote:
> 3.3-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Alan Stern <[email protected]>
> 
> commit f2791d733a2f06997b573d1a3cfde21e6f529826 upstream.
> 
> This patch (as1535) fixes a bug in the runtime PM core.  When a
> runtime suspend attempt completes, whether successfully or not, the
> device's power.wait_queue is supposed to be signalled.  But this
> doesn't happen in the failure pathway of rpm_suspend() when another
> autosuspend attempt is rescheduled.  As a result, a task can get stuck
> indefinitely on the wait queue (I have seen this happen in testing).
> 
> The patch fixes the problem by moving the wake_up_all() call up near
> the start of the failure code.
[...]

It looks like this is also relevant to 3.2, but the code got moved
around a bit between 3.2 and 3.3.  Attaching my (untested) backport.

Ben.

-- 
Ben Hutchings
It is easier to change the specification to fit the program than vice versa.
From 3853eee3a7aae2eda1bb8f9f0c9b8226cbba4bfb Mon Sep 17 00:00:00 2001
From: Alan Stern <[email protected]>
Date: Mon, 26 Mar 2012 22:46:52 +0200
Subject: [PATCH] PM / Runtime: don't forget to wake up waitqueue on failure

commit f2791d733a2f06997b573d1a3cfde21e6f529826 upstream.

This patch (as1535) fixes a bug in the runtime PM core.  When a
runtime suspend attempt completes, whether successfully or not, the
device's power.wait_queue is supposed to be signalled.  But this
doesn't happen in the failure pathway of rpm_suspend() when another
autosuspend attempt is rescheduled.  As a result, a task can get stuck
indefinitely on the wait queue (I have seen this happen in testing).

The patch fixes the problem by moving the wake_up_all() call up near
the start of the failure code.

Signed-off-by: Alan Stern <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
[bwh: Backported to 3.2: adjust context and indentation]
Signed-off-by: Ben Hutchings <[email protected]>
---
 drivers/base/power/runtime.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 8c78443..2424be5 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -417,6 +417,8 @@ static int rpm_suspend(struct device *dev, int rpmflags)
 	if (retval) {
 		__update_runtime_status(dev, RPM_ACTIVE);
 		dev->power.deferred_resume = false;
+		wake_up_all(&dev->power.wait_queue);
+
 		if (retval == -EAGAIN || retval == -EBUSY) {
 			dev->power.runtime_error = 0;
 
@@ -432,7 +434,6 @@ static int rpm_suspend(struct device *dev, int rpmflags)
 		} else {
 			pm_runtime_cancel_pending(dev);
 		}
-		wake_up_all(&dev->power.wait_queue);
 		goto out;
 	}
  no_callback:
-- 
1.7.9.5

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to