public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM: runtime: fix recursive locking warning of lockdep from rpm_resume
@ 2010-10-22 11:58 tom.leiming
  2010-10-22 14:25 ` Alan Stern
  0 siblings, 1 reply; 3+ messages in thread
From: tom.leiming @ 2010-10-22 11:58 UTC (permalink / raw)
  To: rjw, stern; +Cc: linux-pm

From: Ming Lei <tom.leiming@gmail.com>

For device with no_callbacks flag set, its power lock and its parent's
power lock may be held nestedly in rpm_resume, so we should take
spin_lock_nested(lock, SINGLE_DEPTH_NESTING) to acquire parent power lock
to avoid lockdep warning.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 drivers/base/power/runtime.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 1dd8676..126ca49 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -503,7 +503,7 @@ static int rpm_resume(struct device *dev, int rpmflags)
 	 * the resume will actually succeed.
 	 */
 	if (dev->power.no_callbacks && !parent && dev->parent) {
-		spin_lock(&dev->parent->power.lock);
+		spin_lock_nested(&dev->parent->power.lock, SINGLE_DEPTH_NESTING);
 		if (dev->parent->power.disable_depth > 0
 		    || dev->parent->power.ignore_children
 		    || dev->parent->power.runtime_status == RPM_ACTIVE) {
-- 
1.7.3

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

* Re: [PATCH] PM: runtime: fix recursive locking warning of lockdep from rpm_resume
  2010-10-22 11:58 [PATCH] PM: runtime: fix recursive locking warning of lockdep from rpm_resume tom.leiming
@ 2010-10-22 14:25 ` Alan Stern
  2010-10-22 21:50   ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Stern @ 2010-10-22 14:25 UTC (permalink / raw)
  To: Ming Lei; +Cc: linux-pm

On Fri, 22 Oct 2010 tom.leiming@gmail.com wrote:

> From: Ming Lei <tom.leiming@gmail.com>
> 
> For device with no_callbacks flag set, its power lock and its parent's
> power lock may be held nestedly in rpm_resume, so we should take
> spin_lock_nested(lock, SINGLE_DEPTH_NESTING) to acquire parent power lock
> to avoid lockdep warning.
> 
> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
> ---
>  drivers/base/power/runtime.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
> index 1dd8676..126ca49 100644
> --- a/drivers/base/power/runtime.c
> +++ b/drivers/base/power/runtime.c
> @@ -503,7 +503,7 @@ static int rpm_resume(struct device *dev, int rpmflags)
>  	 * the resume will actually succeed.
>  	 */
>  	if (dev->power.no_callbacks && !parent && dev->parent) {
> -		spin_lock(&dev->parent->power.lock);
> +		spin_lock_nested(&dev->parent->power.lock, SINGLE_DEPTH_NESTING);
>  		if (dev->parent->power.disable_depth > 0
>  		    || dev->parent->power.ignore_children
>  		    || dev->parent->power.runtime_status == RPM_ACTIVE) {

Quite correct; I don't know why this didn't show up during my testing.

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

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

* Re: [PATCH] PM: runtime: fix recursive locking warning of lockdep from rpm_resume
  2010-10-22 14:25 ` Alan Stern
@ 2010-10-22 21:50   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2010-10-22 21:50 UTC (permalink / raw)
  To: Alan Stern; +Cc: linux-pm

On Friday, October 22, 2010, Alan Stern wrote:
> On Fri, 22 Oct 2010 tom.leiming@gmail.com wrote:
> 
> > From: Ming Lei <tom.leiming@gmail.com>
> > 
> > For device with no_callbacks flag set, its power lock and its parent's
> > power lock may be held nestedly in rpm_resume, so we should take
> > spin_lock_nested(lock, SINGLE_DEPTH_NESTING) to acquire parent power lock
> > to avoid lockdep warning.
> > 
> > Signed-off-by: Ming Lei <tom.leiming@gmail.com>
> > ---
> >  drivers/base/power/runtime.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
> > index 1dd8676..126ca49 100644
> > --- a/drivers/base/power/runtime.c
> > +++ b/drivers/base/power/runtime.c
> > @@ -503,7 +503,7 @@ static int rpm_resume(struct device *dev, int rpmflags)
> >  	 * the resume will actually succeed.
> >  	 */
> >  	if (dev->power.no_callbacks && !parent && dev->parent) {
> > -		spin_lock(&dev->parent->power.lock);
> > +		spin_lock_nested(&dev->parent->power.lock, SINGLE_DEPTH_NESTING);
> >  		if (dev->parent->power.disable_depth > 0
> >  		    || dev->parent->power.ignore_children
> >  		    || dev->parent->power.runtime_status == RPM_ACTIVE) {
> 
> Quite correct; I don't know why this didn't show up during my testing.
> 
> Acked-by: Alan Stern <stern@rowland.harvard.edu>

Applied to suspend-2.6/pm-fixes, will push to Linus early next week.

Thanks,
Rafael

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

end of thread, other threads:[~2010-10-22 21:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-22 11:58 [PATCH] PM: runtime: fix recursive locking warning of lockdep from rpm_resume tom.leiming
2010-10-22 14:25 ` Alan Stern
2010-10-22 21:50   ` Rafael J. Wysocki

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