scsi: mq queue stall during command requeue
PATCH 1/1 scsi: mq queue stall during command requeue
When we're hitting a busy condition in queuecommand() we need to stop the hardware queue before calling blk_mq_delay_queue(); if we don't blk_mq_delay_queue() will not do anything and requeue will never triggered.
--- drivers/scsi/scsi_lib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/scsi_lib.c +3 -1
@@ -1951,8 +1951,10 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx,switch (ret) {case BLK_MQ_RQ_QUEUE_BUSY :if (atomic_read (&sdev->device_busy) ==0 && - !scsi_device_blocked (sdev)) + !scsi_device_blocked (sdev)) { +blk_mq_stop_hw_queue (hctx);blk_mq_delay_queue (hctx,SCSI_QUEUE_DELAY ); + }break ;case BLK_MQ_RQ_QUEUE_ERROR :/*
Signature · 1 line
1.8.5.6
Quoted 4 lines · Hannes Reinecke
When we're hitting a busy condition in
queuecommand()we need to stop the hardware queue before callingblk_mq_delay_queue(); if we don'tblk_mq_delay_queue()will not do anything and requeue will never triggered.
I suspect the stop needs to move into blk_mq_delay_queue to make it more useful.
Quoted 9 lines · Christoph Hellwig
Quoted 4 lines · Hannes Reinecke
When we're hitting a busy condition in
queuecommand()we need to stop the hardware queue before callingblk_mq_delay_queue(); if we don'tblk_mq_delay_queue()will not do anything and requeue will never triggered.I suspect the stop needs to move into
blk_mq_delay_queueto make it more useful.
Which is what I've suggested to Jens, too.
And he even agreed to it :-)
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Quoted 7 lines · Hannes Reinecke
Quoted 6 lines · Christoph Hellwig
Quoted 4 lines · Hannes Reinecke
When we're hitting a busy condition in
queuecommand()we need to stop the hardware queue before callingblk_mq_delay_queue(); if we don'tblk_mq_delay_queue()will not do anything and requeue will never triggered.
Quoted 5 lines
Quoted 3 lines
I suspect the stop needs to move into
blk_mq_delay_queueto make it more useful.Which is what I've suggested to Jens, too.
And he even agreed to it :-)
Yeah, I made that patch and grepped the tree. The usage in the fc code in nvme looks weird. It's stopping all potential hardware queues, yet only delaying one.
if (op->rq) {
blk_mq_stop_hw_queues(op->rq->q);
blk_mq_delay_queue(queue->hctx, NVMEFC_QUEUE_DELAY);
} return BLK_MQ_RQ_QUEUE_BUSY;
James/Christoph, what's going on there? I'm going to leave that one as-is for now, but add the stop to the delay. If the above stop-all is indeed buggy, then it can later just be removed.
Signature · 1 line
Jens Axboe
Quoted 8 lines · Jens Axboe
Yeah, I made that patch and grepped the tree. The usage in the fc code in nvme looks weird. It's stopping all potential hardware queues, yet only delaying one.
if (op->rq) { blk_mq_stop_hw_queues(op->rq->q); blk_mq_delay_queue(queue->hctx, NVMEFC_QUEUE_DELAY); }
Quoted 5 lines
return
BLK_MQ_RQ_QUEUE_BUSY;James/Christoph, what's going on there? I'm going to leave that one as-is for now, but add the stop to the delay. If the above stop-all is indeed buggy, then it can later just be removed.
It looks broken to me, but I'll need James to confirm.
Quoted 16 lines · Hannes Reinecke
When we're hitting a busy condition in
queuecommand()we need to stop the hardware queue before callingblk_mq_delay_queue(); if we don'tblk_mq_delay_queue()will not do anything and requeue will never triggered.Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/scsi_lib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/scsi/scsi_lib.c +0
-0@@ -1951,8 +1951,10 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx,switch (ret) {
drivers/scsi/scsi_lib.c static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, · line 1960
Quoted 10 lines
drivers/scsi/scsi_lib.c +3
-1case BLK_MQ_RQ_QUEUE_BUSY :if (atomic_read (&sdev->device_busy) ==0 && - !scsi_device_blocked (sdev)) + !scsi_device_blocked (sdev)) { +blk_mq_stop_hw_queue (hctx);blk_mq_delay_queue (hctx,SCSI_QUEUE_DELAY ); + }break ;case BLK_MQ_RQ_QUEUE_ERROR :/*
You may want to add Fixes: 52d7f1b5c2f3 (blk-mq: Avoid that requeueing starts stopped queues). See also
https://www.spinics.net/lists/linux-block/msg06144.html.
Bart.
Quoted 23 lines · Bart Van Assche
Quoted 22 lines · Hannes Reinecke
When we're hitting a busy condition in
queuecommand()we need to stop the hardware queue before callingblk_mq_delay_queue(); if we don'tblk_mq_delay_queue()will not do anything and requeue will never triggered.Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/scsi_lib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/scsi/scsi_lib.c +2
-1@@ -1951,8 +1951,10 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx,switch (ret) {case BLK_MQ_RQ_QUEUE_BUSY :if (atomic_read (&sdev->device_busy) ==0 && - !scsi_device_blocked (sdev)) + !scsi_device_blocked (sdev)) { +blk_mq_stop_hw_queue (hctx);blk_mq_delay_queue (hctx,SCSI_QUEUE_DELAY );
Quoted 9 lines
drivers/scsi/scsi_lib.c static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, · line 1960
Quoted 4 lines
drivers/scsi/scsi_lib.c +1
-0+ }break ;case BLK_MQ_RQ_QUEUE_ERROR :/* You may want to add Fixes:
52d7f1b5c2f3(blk-mq: Avoid that requeueing starts stopped queues). See also
https://www.spinics.net/lists/linux-block/msg06144.html.
Yes indeed.
But the powers that be still ponder if it should be fixed in the SCSI stack or whether it's a generic fix for blk_mq_delay_queue().
Cheers,
Hannes
Signature · 5 lines
Dr. Hannes Reinecke Teamlead Storage & Networking [email protected] +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)