All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: really disable runtime-pm for blk-mq
@ 2018-07-30 12:02 Ming Lei
  2018-07-30 14:50 ` Patrick Steinhardt
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Ming Lei @ 2018-07-30 12:02 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Ming Lei, Christoph Hellwig, Patrick Steinhardt,
	Bart Van Assche, Tomas Janousek, Przemek Socha, Alan Stern,
	stable

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 <hch@lst.de>
Cc: Patrick Steinhardt <ps@pks.im>
Cc: Bart Van Assche <Bart.VanAssche@wdc.com>
Cc: Tomas Janousek <tomi@nomi.cz>
Cc: Przemek Socha <soprwa@gmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: <stable@vger.kernel.org>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 03a4ea93a5f3..090b782df129 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -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;
-- 
2.9.5

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

* Re: [PATCH] block: really disable runtime-pm for blk-mq
  2018-07-30 12:02 [PATCH] block: really disable runtime-pm for blk-mq Ming Lei
@ 2018-07-30 14:50 ` Patrick Steinhardt
  2018-07-30 15:14 ` Przemek Socha
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Patrick Steinhardt @ 2018-07-30 14:50 UTC (permalink / raw)
  To: Ming Lei
  Cc: Jens Axboe, linux-block, Christoph Hellwig, Bart Van Assche,
	Tomas Janousek, Przemek Socha, Alan Stern, stable

[-- Attachment #1: Type: text/plain, Size: 1641 bytes --]

On Mon, Jul 30, 2018 at 08:02:19PM +0800, Ming Lei wrote:
> 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!

> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Patrick Steinhardt <ps@pks.im>
> Cc: Bart Van Assche <Bart.VanAssche@wdc.com>
> Cc: Tomas Janousek <tomi@nomi.cz>
> Cc: Przemek Socha <soprwa@gmail.com>
> Cc: Alan Stern <stern@rowland.harvard.edu>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
>  block/blk-core.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 03a4ea93a5f3..090b782df129 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -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;
> -- 
> 2.9.5
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] block: really disable runtime-pm for blk-mq
  2018-07-30 12:02 [PATCH] block: really disable runtime-pm for blk-mq Ming Lei
  2018-07-30 14:50 ` Patrick Steinhardt
@ 2018-07-30 15:14 ` Przemek Socha
  2018-07-30 20:43   ` Bart Van Assche
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Przemek Socha @ 2018-07-30 15:14 UTC (permalink / raw)
  To: Ming Lei
  Cc: Christoph Hellwig, Patrick Steinhardt, Bart Van Assche,
	Tomas Janousek, Alan Stern, stable

Dnia poniedziałek, 30 lipca 2018 14:02:19 CEST piszesz:
> 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 <hch@lst.de>
> Cc: Patrick Steinhardt <ps@pks.im>
> Cc: Bart Van Assche <Bart.VanAssche@wdc.com>
> Cc: Tomas Janousek <tomi@nomi.cz>
> Cc: Przemek Socha <soprwa@gmail.com>
> Cc: Alan Stern <stern@rowland.harvard.edu>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
>  block/blk-core.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 03a4ea93a5f3..090b782df129 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -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;

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.

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

* Re: [PATCH] block: really disable runtime-pm for blk-mq
  2018-07-30 12:02 [PATCH] block: really disable runtime-pm for blk-mq Ming Lei
@ 2018-07-30 20:43   ` Bart Van Assche
  2018-07-30 15:14 ` Przemek Socha
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Bart Van Assche @ 2018-07-30 20:43 UTC (permalink / raw)
  To: ming.lei, axboe; +Cc: hch, tomi, linux-block, ps, soprwa, stern, stable

On Mon, 2018-07-30 at 20:02 +0800, Ming Lei wrote:
> Runtime PM isn't ready for blk-mq yet, and commit 765e40b675a9 ("=
block:
> disable runtime-pm for blk-mq") tried to disable it. Unfortunatel=
y,
> 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()
> and fixes all kinds of PM related kernel crash.

Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>

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

* Re: [PATCH] block: really disable runtime-pm for blk-mq
@ 2018-07-30 20:43   ` Bart Van Assche
  0 siblings, 0 replies; 7+ messages in thread
From: Bart Van Assche @ 2018-07-30 20:43 UTC (permalink / raw)
  To: ming.lei, axboe; +Cc: hch, tomi, linux-block, ps, soprwa, stern, stable

On Mon, 2018-07-30 at 20:02 +0800, Ming Lei wrote:
> 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.

Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>

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

* Re: [PATCH] block: really disable runtime-pm for blk-mq
  2018-07-30 12:02 [PATCH] block: really disable runtime-pm for blk-mq Ming Lei
                   ` (2 preceding siblings ...)
  2018-07-30 20:43   ` Bart Van Assche
@ 2018-08-01 14:55 ` Christoph Hellwig
  2018-08-02 16:36 ` Jens Axboe
  4 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2018-08-01 14:55 UTC (permalink / raw)
  To: Ming Lei
  Cc: Jens Axboe, linux-block, Christoph Hellwig, Patrick Steinhardt,
	Bart Van Assche, Tomas Janousek, Przemek Socha, Alan Stern,
	stable

On Mon, Jul 30, 2018 at 08:02:19PM +0800, Ming Lei wrote:
> 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,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH] block: really disable runtime-pm for blk-mq
  2018-07-30 12:02 [PATCH] block: really disable runtime-pm for blk-mq Ming Lei
                   ` (3 preceding siblings ...)
  2018-08-01 14:55 ` Christoph Hellwig
@ 2018-08-02 16:36 ` Jens Axboe
  4 siblings, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2018-08-02 16:36 UTC (permalink / raw)
  To: Ming Lei
  Cc: linux-block, Christoph Hellwig, Patrick Steinhardt,
	Bart Van Assche, Tomas Janousek, Przemek Socha, Alan Stern,
	stable

On 7/30/18 6:02 AM, Ming Lei wrote:
> 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.

-- 
Jens Axboe

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

end of thread, other threads:[~2018-08-02 16:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-30 12:02 [PATCH] block: really disable runtime-pm for blk-mq Ming Lei
2018-07-30 14:50 ` Patrick Steinhardt
2018-07-30 15:14 ` Przemek Socha
2018-07-30 20:43 ` Bart Van Assche
2018-07-30 20:43   ` Bart Van Assche
2018-08-01 14:55 ` Christoph Hellwig
2018-08-02 16:36 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.