block: really disable runtime-pm for blk-mq
authorMing Lei <[email protected]>
Mon, 30 Jul 2018 12:02:19 +0000 (20:02 +0800)
committerJens Axboe <[email protected]>
Thu, 2 Aug 2018 16:36:02 +0000 (10:36 -0600)
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: Tomas Janousek <[email protected]>
Cc: Przemek Socha <[email protected]>
Cc: Alan Stern <[email protected]>
Cc: <[email protected]>
Reviewed-by: Bart Van Assche <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Tested-by: Patrick Steinhardt <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
block/blk-core.c

index 23cd1b7770e706c1824cd819c8ec91209ab1cbd0..f9ad73d8573c857a5538e6ca0a7decadeb8cc781 100644 (file)
@@ -3770,9 +3770,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;