Skip to contentSkip to conversation

blkpm: avoid sleep when holding queue lock

PATCH Applied Aaron Lu 2 participants 2 messages May 17, 2013 Block layer

lore
Share & tools
lore

Aaron Lu

author
#0 lore raw

PATCH 1/1 blkpm: avoid sleep when holding queue lock

In blk_post_runtime_resume, an autosuspend request will be initiated for the device. Since we are holding the queue lock, we can't sleep and thus we should use the async version to initiate an autosuspend, i.e. pm_request_suspend instead of pm_runtime_suspend, which might sleep.

---
I didn't turn on the lock debugging config options while doing test so this issue didn't show up until recently I have all those lock debugging options turned on, a warning instantly showed up. While it is correctly using pm_request_autosuspend in pre-v7 series, and is brought by me mistakenly, sorry for this.

 block/blk-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-core.c +1 -1
index 33c33bc..d5745b5 100644
@@ -3164,7 +3164,7 @@ void blk_post_runtime_resume(struct request_queue *q, int err)
 		q->rpm_status = RPM_ACTIVE;
 		__blk_run_queue(q);
 		pm_runtime_mark_last_busy(q->dev);
-		pm_runtime_autosuspend(q->dev);
+		pm_request_autosuspend(q->dev);
 	} else {
 		q->rpm_status = RPM_SUSPENDED;
 	}
Signature · 1 line
1.8.3.rc2
maintainer Applied
#1 lore raw
Quoted 31 lines · Aaron Lu

In blk_post_runtime_resume, an autosuspend request will be initiated for the device. Since we are holding the queue lock, we can't sleep and thus we should use the async version to initiate an autosuspend, i.e. pm_request_suspend instead of pm_runtime_suspend, which might sleep.

---
I didn't turn on the lock debugging config options while doing test so this issue didn't show up until recently I have all those lock debugging options turned on, a warning instantly showed up. While it is correctly using pm_request_autosuspend in pre-v7 series, and is brought by me mistakenly, sorry for this.

 block/blk-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-core.c +1 -1
index 33c33bc..d5745b5 100644
@@ -3164,7 +3164,7 @@ void blk_post_runtime_resume(struct request_queue *q, int err)
 		q->rpm_status = RPM_ACTIVE;
 		__blk_run_queue(q);
 		pm_runtime_mark_last_busy(q->dev);
-		pm_runtime_autosuspend(q->dev);
+		pm_request_autosuspend(q->dev);
 	} else {
 		q->rpm_status = RPM_SUSPENDED;
 	}
Signature · 1 line
1.8.3.rc2

Thanks applied, obviously right.

Signature · 1 line
Jens Axboe