public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM: fix a lockdep warning in runtime.c
@ 2009-12-02 20:56 Alan Stern
  2009-12-02 21:15 ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Stern @ 2009-12-02 20:56 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Linux-pm mailing list

This patch (as1309) fixes a lockdep warning in
__pm_runtime_set_status().  This is the one place where the runtime PM
framework acquires a nested power.lock, and the nesting is never more
than one deep.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

---

If anybody is using the runtime PM framework in 2.6.32 then this 
should be pushed before the final release.



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
@@ -10,6 +10,8 @@
 #include <linux/pm_runtime.h>
 #include <linux/jiffies.h>
 
+#define	RPM_LOCK_PARENT		1
+
 static int __pm_runtime_resume(struct device *dev, bool from_wq);
 static int __pm_request_idle(struct device *dev);
 static int __pm_request_resume(struct device *dev);
@@ -793,7 +795,7 @@ int __pm_runtime_set_status(struct devic
 	}
 
 	if (parent) {
-		spin_lock(&parent->power.lock);
+		spin_lock_nested(&parent->power.lock, RPM_LOCK_PARENT);
 
 		/*
 		 * It is invalid to put an active child under a parent that is

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

* Re: [PATCH] PM: fix a lockdep warning in runtime.c
  2009-12-02 20:56 [PATCH] PM: fix a lockdep warning in runtime.c Alan Stern
@ 2009-12-02 21:15 ` Rafael J. Wysocki
  2009-12-02 21:36   ` Alan Stern
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2009-12-02 21:15 UTC (permalink / raw)
  To: Alan Stern; +Cc: Linux-pm mailing list

On Wednesday 02 December 2009, Alan Stern wrote:
> This patch (as1309) fixes a lockdep warning in
> __pm_runtime_set_status().  This is the one place where the runtime PM
> framework acquires a nested power.lock, and the nesting is never more
> than one deep.
> 
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

I have a very simila patch queued up already.  The only difference is that it
uses SINGLE_DEPTH_NESTING instead of the new symbol.  My version is appended
below.

> 
> ---
> 
> If anybody is using the runtime PM framework in 2.6.32 then this 
> should be pushed before the final release.

I'll push it to Linus, then, if there still is time.  Would you mind if I used
my version?

Thanks,
Rafael

 
> 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
> @@ -10,6 +10,8 @@
>  #include <linux/pm_runtime.h>
>  #include <linux/jiffies.h>
>  
> +#define	RPM_LOCK_PARENT		1
> +
>  static int __pm_runtime_resume(struct device *dev, bool from_wq);
>  static int __pm_request_idle(struct device *dev);
>  static int __pm_request_resume(struct device *dev);
> @@ -793,7 +795,7 @@ int __pm_runtime_set_status(struct devic
>  	}
>  
>  	if (parent) {
> -		spin_lock(&parent->power.lock);
> +		spin_lock_nested(&parent->power.lock, RPM_LOCK_PARENT);
>  
>  		/*
>  		 * It is invalid to put an active child under a parent that is

---
From: Rafael J. Wysocki <rjw@sisk.pl>
Subject: PM / Runtime: Fix lockdep warning in __pm_runtime_set_status()

Lockdep complains about taking the parent lock in
__pm_runtime_set_status(), so mark it as nested.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/base/power/runtime.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/drivers/base/power/runtime.c
===================================================================
--- linux-2.6.orig/drivers/base/power/runtime.c
+++ linux-2.6/drivers/base/power/runtime.c
@@ -777,7 +777,7 @@ int __pm_runtime_set_status(struct devic
 	}
 
 	if (parent) {
-		spin_lock(&parent->power.lock);
+		spin_lock_nested(&parent->power.lock, SINGLE_DEPTH_NESTING);
 
 		/*
 		 * It is invalid to put an active child under a parent that is

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

* Re: [PATCH] PM: fix a lockdep warning in runtime.c
  2009-12-02 21:15 ` Rafael J. Wysocki
@ 2009-12-02 21:36   ` Alan Stern
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Stern @ 2009-12-02 21:36 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Linux-pm mailing list

On Wed, 2 Dec 2009, Rafael J. Wysocki wrote:

> On Wednesday 02 December 2009, Alan Stern wrote:
> > This patch (as1309) fixes a lockdep warning in
> > __pm_runtime_set_status().  This is the one place where the runtime PM
> > framework acquires a nested power.lock, and the nesting is never more
> > than one deep.
> > 
> > Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> 
> I have a very simila patch queued up already.  The only difference is that it
> uses SINGLE_DEPTH_NESTING instead of the new symbol.  My version is appended
> below.
> 
> > 
> > ---
> > 
> > If anybody is using the runtime PM framework in 2.6.32 then this 
> > should be pushed before the final release.
> 
> I'll push it to Linus, then, if there still is time.  Would you mind if I used
> my version?

That's fine.  I would have used SINGLE_DEPTH_NESTING if I had seen its 
definition.

Alan Stern

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

end of thread, other threads:[~2009-12-02 21:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-02 20:56 [PATCH] PM: fix a lockdep warning in runtime.c Alan Stern
2009-12-02 21:15 ` Rafael J. Wysocki
2009-12-02 21:36   ` Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox