PM: runtime: fix recursive locking warning of lockdep from rpm_resume
Subsystems (4)
PATCH 1/1 PM: runtime: fix recursive locking warning of lockdep from rpm_resume
From: Ming Lei <[email protected]>
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.
--- drivers/base/power/runtime.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/base/power/runtime.c +1 -1
@@ -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 ) {
Signature · 1 line
1.7.3
Quoted 17 lines · On Fri, 22 Oct 2010 [email protected] wrote:
From: Ming Lei <[email protected]>
For device with
no_callbacksflag set, its power lock and its parent's power lock may be held nestedly inrpm_resume, so we should takespin_lock_nested(lock, SINGLE_DEPTH_NESTING)to acquire parent power lock to avoid lockdep warning.Signed-off-by Ming Lei <[email protected]>--- drivers/base/power/runtime.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/base/power/runtime.c +0
-0
drivers/base/power/runtime.c static int rpm_resume(struct device *dev, int rpmflags) · line 509
Quoted 8 lines
drivers/base/power/runtime.c +1
-1@@ -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.
Rafael J. Wysocki
AppliedQuoted 30 lines · Alan Stern
Quoted 17 lines · On Fri, 22 Oct 2010 [email protected] wrote:
From: Ming Lei <[email protected]>
For device with
no_callbacksflag set, its power lock and its parent's power lock may be held nestedly inrpm_resume, so we should takespin_lock_nested(lock, SINGLE_DEPTH_NESTING)to acquire parent power lock to avoid lockdep warning.Signed-off-by Ming Lei <[email protected]>--- drivers/base/power/runtime.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/base/power/runtime.c +0
-0drivers/base/power/runtime.c static int rpm_resume(struct device *dev, int rpmflags) · line 509
Quoted 8 lines
drivers/base/power/runtime.c +1
-1@@ -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.
Quoted 1 line
Acked-by Alan Stern <[email protected]>
Applied to suspend-2.6/pm-fixes, will push to Linus early next week.
Thanks,
Rafael