Skip to contentSkip to conversation

block: really disable runtime-pm for blk-mq

PATCH Applied Ming Lei 6 participants 6 messages Jul 30, 2018 – Aug 2, 2018

Subsystems (2)
lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 block: really disable runtime-pm for blk-mq

Runtime PM isn't ready for blk-mq yet, and commit 765e40b675a9 ("block:
disable runtime-pm for blk-mq") tried to disable it. Unfortunately, it can't take effect in that way since user space still can switch it on via 'echo auto > /sys/block/sdN/device/power/control'.

This patch disables runtime-pm for blk-mq really by pm_runtime_disable() and fixes all kinds of PM related kernel crash.

Cc Christoph Hellwig <[email protected]>
Cc Patrick Steinhardt <[email protected]>
Cc Bart Van Assche <[email protected]>
Cc Tomas Janousek <[email protected]>
Cc Przemek Socha <[email protected]>
Cc Alan Stern <[email protected]>
---
 block/blk-core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
block/blk-core.c +4 -2
index 03a4ea93a5f3..090b782df129 100644
@@ -3769,9 +3769,11 @@ EXPORT_SYMBOL(blk_finish_plug);
  */
 void blk_pm_runtime_init(struct request_queue *q, struct device *dev)
 {
-	/* not support for RQF_PM and ->rpm_status in blk-mq yet */
-	if (q->mq_ops)
+	/* Don't enable runtime PM for blk-mq until it is ready */
+	if (q->mq_ops) {
+		pm_runtime_disable(dev);
 		return;
+	}
 
 	q->dev = dev;
 	q->rpm_status = RPM_ACTIVE;
Signature · 1 line
2.9.5
#1 lore raw
Quoted 7 lines · Ming Lei

Runtime PM isn't ready for blk-mq yet, and commit 765e40b675a9 ("block:
disable runtime-pm for blk-mq") tried to disable it. Unfortunately, it can't take effect in that way since user space still can switch it on via 'echo auto > /sys/block/sdN/device/power/control'.

This patch disables runtime-pm for blk-mq really by pm_runtime_disable() and fixes all kinds of PM related kernel crash.

I can confirm that this patch fixes the kernel panics I've seen. For what it's worth, the USB hotplugging issues didn't re-surface, either. Thanks!

Quoted 33 lines
Cc Christoph Hellwig <[email protected]>
Cc Patrick Steinhardt <[email protected]>
Cc Bart Van Assche <[email protected]>
Cc Tomas Janousek <[email protected]>
Cc Przemek Socha <[email protected]>
Cc Alan Stern <[email protected]>
---
 block/blk-core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
block/blk-core.c +4 -2
index 03a4ea93a5f3..090b782df129 100644
@@ -3769,9 +3769,11 @@ EXPORT_SYMBOL(blk_finish_plug);
  */
 void blk_pm_runtime_init(struct request_queue *q, struct device *dev)
 {
-	/* not support for RQF_PM and ->rpm_status in blk-mq yet */
-	if (q->mq_ops)
+	/* Don't enable runtime PM for blk-mq until it is ready */
+	if (q->mq_ops) {
+		pm_runtime_disable(dev);
 		return;
+	}
 
 	q->dev = dev;
 	q->rpm_status = RPM_ACTIVE;
Signature · 1 line
2.9.5
#2 lore raw
In reply to Ming Lei

Dnia poniedziałek, 30 lipca 2018 14:02:19 CEST piszesz:

Quoted 28 lines

Runtime PM isn't ready for blk-mq yet, and commit 765e40b675a9 ("block:
disable runtime-pm for blk-mq") tried to disable it. Unfortunately, it can't take effect in that way since user space still can switch it on via 'echo auto > /sys/block/sdN/device/power/control'.

This patch disables runtime-pm for blk-mq really by pm_runtime_disable() and fixes all kinds of PM related kernel crash.

Cc Christoph Hellwig <[email protected]>
Cc Patrick Steinhardt <[email protected]>
Cc Bart Van Assche <[email protected]>
Cc Tomas Janousek <[email protected]>
Cc Przemek Socha <[email protected]>
Cc Alan Stern <[email protected]>
---
 block/blk-core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
block/blk-core.c +0 -0
index 03a4ea93a5f3..090b782df129 100644
@@ -3769,9 +3769,11 @@ EXPORT_SYMBOL(blk_finish_plug);
  */
 void blk_pm_runtime_init(struct request_queue *q, struct device *dev)
 {

block/blk-core.c EXPORT_SYMBOL(blk_finish_plug); · line 3779

Quoted 10 lines
block/blk-core.c +4 -2
-	/* not support for RQF_PM and ->rpm_status in blk-mq yet */
-	if (q->mq_ops)
+	/* Don't enable runtime PM for blk-mq until it is ready */
+	if (q->mq_ops) {
+		pm_runtime_disable(dev);
 		return;
+	}
 
 	q->dev = dev;
 	q->rpm_status = RPM_ACTIVE;

This patch works perfectly with SATA ssd. I have checked "resume" with all schedulers and with kernel command line "scsi_mod.use_blk_mq=1" option (bfq, kyber, deadline-mq). There is no more kernel oops with NULL pointer dereference, and machine can resume successfully. When this patch will get to stable tree i will close that bug report : https://bugzilla.kernel.org/
show_bug.cgi?id=200435.

Thank you very much,
Przemek.

Reviewed-by on v1 1/1
#3 lore raw
In reply to Ming Lei
Quoted 1 line · Ming Lei

Runtime PM isn't ready for blk-mq yet, and commit 765e40b675a9 ("=

block:

Quoted 1 line

disable runtime-pm for blk-mq") tried to disable it. Unfortunatel=

y,

Quoted 4 lines

it can't take effect in that way since user space still can switch it on via 'echo auto > /sys/block/sdN/device/power/control'. =20
This patch disables runtime-pm for blk-mq really by pm_runtime�

8-disable()

Quoted 1 line

and fixes all kinds of PM related kernel crash.

Reviewed-by on v1 1/1
#4 lore raw
In reply to Ming Lei
Quoted 7 lines · Ming Lei

Runtime PM isn't ready for blk-mq yet, and commit 765e40b675a9 ("block:
disable runtime-pm for blk-mq") tried to disable it. Unfortunately, it can't take effect in that way since user space still can switch it on via 'echo auto > /sys/block/sdN/device/power/control'.

This patch disables runtime-pm for blk-mq really by pm_runtime_disable() and fixes all kinds of PM related kernel crash.

Looks good,

maintainer Applied
#5 lore raw
In reply to Ming Lei
Quoted 7 lines · Ming Lei

Runtime PM isn't ready for blk-mq yet, and commit 765e40b675a9 ("block:
disable runtime-pm for blk-mq") tried to disable it. Unfortunately, it can't take effect in that way since user space still can switch it on via 'echo auto > /sys/block/sdN/device/power/control'.

This patch disables runtime-pm for blk-mq really by pm_runtime_disable() and fixes all kinds of PM related kernel crash.

Applied, thanks Ming.

Signature · 1 line
Jens Axboe