All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM: don't enable interrupts while running in_interrupt
@ 2011-01-25 18:08 Alan Stern
  2011-01-25 19:53 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Stern @ 2011-01-25 18:08 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: tim blechmann, Linux-pm mailing list

This patch (as1445) fixes a bug in the runtime PM core left over from
the addition of the no_callbacks flag.  If this flag is set then it is
possible for rpm_suspend() to be called in_interrupt, so when
releasing spinlocks it's important not to re-enable interrupts.  

To avoid an unnecessary save-and-restore of the interrupt flag, the
patch also inlines a pm_request_idle() call.

This fixes Bugzilla #27482.

(The offending code was added in 2.6.37, so it's not necessary to apply
this to any earlier stable kernels.)

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: tim blechmann <tim@klingt.org>
CC: <stable@kernel.org>

---

Index: usb-2.6/drivers/base/power/runtime.c
===================================================================
--- usb-2.6.orig/drivers/base/power/runtime.c
+++ usb-2.6/drivers/base/power/runtime.c
@@ -407,12 +407,15 @@ static int rpm_suspend(struct device *de
 		goto out;
 	}
 
+	/* Maybe the parent is now able to suspend. */
 	if (parent && !parent->power.ignore_children && !dev->power.irq_safe) {
-		spin_unlock_irq(&dev->power.lock);
+		spin_unlock(&dev->power.lock);
 
-		pm_request_idle(parent);
+		spin_lock(&parent->power.lock);
+		rpm_idle(parent, RPM_ASYNC);
+		spin_unlock(&parent->power.lock);
 
-		spin_lock_irq(&dev->power.lock);
+		spin_lock(&dev->power.lock);
 	}
 
  out:

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] PM: don't enable interrupts while running in_interrupt
  2011-01-25 18:08 [PATCH] PM: don't enable interrupts while running in_interrupt Alan Stern
@ 2011-01-25 19:53 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2011-01-25 19:53 UTC (permalink / raw)
  To: Alan Stern; +Cc: tim blechmann, Linux-pm mailing list

On Tuesday, January 25, 2011, Alan Stern wrote:
> This patch (as1445) fixes a bug in the runtime PM core left over from
> the addition of the no_callbacks flag.  If this flag is set then it is
> possible for rpm_suspend() to be called in_interrupt, so when
> releasing spinlocks it's important not to re-enable interrupts.  
> 
> To avoid an unnecessary save-and-restore of the interrupt flag, the
> patch also inlines a pm_request_idle() call.
> 
> This fixes Bugzilla #27482.
> 
> (The offending code was added in 2.6.37, so it's not necessary to apply
> this to any earlier stable kernels.)
> 
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> Reported-by: tim blechmann <tim@klingt.org>
> CC: <stable@kernel.org>

Applied to suspend-2.6/pm-fixes, thanks Alan!


> ---
> 
> Index: usb-2.6/drivers/base/power/runtime.c
> ===================================================================
> --- usb-2.6.orig/drivers/base/power/runtime.c
> +++ usb-2.6/drivers/base/power/runtime.c
> @@ -407,12 +407,15 @@ static int rpm_suspend(struct device *de
>  		goto out;
>  	}
>  
> +	/* Maybe the parent is now able to suspend. */
>  	if (parent && !parent->power.ignore_children && !dev->power.irq_safe) {
> -		spin_unlock_irq(&dev->power.lock);
> +		spin_unlock(&dev->power.lock);
>  
> -		pm_request_idle(parent);
> +		spin_lock(&parent->power.lock);
> +		rpm_idle(parent, RPM_ASYNC);
> +		spin_unlock(&parent->power.lock);
>  
> -		spin_lock_irq(&dev->power.lock);
> +		spin_lock(&dev->power.lock);
>  	}
>  
>   out:
> 
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-25 19:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-25 18:08 [PATCH] PM: don't enable interrupts while running in_interrupt Alan Stern
2011-01-25 19:53 ` Rafael J. Wysocki

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.