xen-blkfront: fix mq start/stop race
Subsystems (3)
PATCH 1/1 xen-blkfront: fix mq start/stop race
When ring buf full, hw queue will be stopped. While blkif interrupt consume request and make free space in ring buf, hw queue will be started again. But since start queue is protected by spin lock while stop not, that will cause a race.
interrupt: process:blkif_interrupt() blkif_queue_rq()
kick_pending_request_queues_locked()
blk_mq_start_stopped_hw_queues()
clear_bit(BLK_MQ_S_STOPPED, &hctx->state)
blk_mq_stop_hw_queue(hctx)
blk_mq_run_hw_queue(hctx, async)
If ring buf is made empty in this case, interrupt will never come, then the hw queue will be stopped forever, all processes waiting for the pending io in the queue will hung.
--- drivers/block/xen-blkfront.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/xen-blkfront.c +1 -1
@@ -912,8 +912,8 @@ out_err:return BLK_MQ_RQ_QUEUE_ERROR ; out_busy: -spin_unlock_irqrestore (&rinfo->ring_lock, flags);blk_mq_stop_hw_queue (hctx); +spin_unlock_irqrestore (&rinfo->ring_lock, flags);return BLK_MQ_RQ_QUEUE_BUSY ; }
Signature · 7 lines
1.7.9.5 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Hi Boris & Juergen,
Could you help review this patch? This is a race and will cause the io hung.
Thanks,
Junxiao.
Quoted 29 lines · Junxiao Bi
When ring buf full, hw queue will be stopped. While blkif interrupt consume request and make free space in ring buf, hw queue will be started again. But since start queue is protected by spin lock while stop not, that will cause a race.
interrupt: process:
blkif_interrupt()blkif_queue_rq()
kick_pending_request_queues_locked()
blk_mq_start_stopped_hw_queues()
clear_bit(BLK_MQ_S_STOPPED, &hctx->state)
blk_mq_stop_hw_queue(hctx)
blk_mq_run_hw_queue(hctx, async)If ring buf is made empty in this case, interrupt will never come, then the hw queue will be stopped forever, all processes waiting for the pending io in the queue will hung.
Signed-off-by Junxiao Bi <[email protected]>Reviewed-by Ankur Arora <[email protected]>--- drivers/block/xen-blkfront.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/block/xen-blkfront.c +0
-0
drivers/block/xen-blkfront.c out_err: · line 919
Quoted 9 lines
drivers/block/xen-blkfront.c +1
-1@@ -912,8 +912,8 @@ out_err:return BLK_MQ_RQ_QUEUE_ERROR ; out_busy: -spin_unlock_irqrestore (&rinfo->ring_lock, flags);blk_mq_stop_hw_queue (hctx); +spin_unlock_irqrestore (&rinfo->ring_lock, flags);return BLK_MQ_RQ_QUEUE_BUSY ; }
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Boris Ostrovsky
Reviewed-byQuoted 27 lines · Junxiao Bi
Hi Boris & Juergen,
Could you help review this patch? This is a race and will cause the io hung.
Thanks,
Junxiao.Quoted 19 lines · Junxiao Bi
When ring buf full, hw queue will be stopped. While blkif interrupt consume request and make free space in ring buf, hw queue will be started again. But since start queue is protected by spin lock while stop not, that will cause a race.
interrupt: process:
blkif_interrupt()blkif_queue_rq()
kick_pending_request_queues_locked()
blk_mq_start_stopped_hw_queues()clear_bit(BLK_MQ_S_STOPPED, &hctx->state) blk_mq_stop_hw_queue(hctx) blk_mq_run_hw_queue(hctx, async)If ring buf is made empty in this case, interrupt will never come, then the hw queue will be stopped forever, all processes waiting for the pending io in the queue will hung.
Signed-off-by Junxiao Bi <[email protected]>Reviewed-by Ankur Arora <[email protected]>
but I think Roger (copied) needs to Ack it.
-boris
Quoted 11 lines
Quoted 11 lines
--- drivers/block/xen-blkfront.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/block/xen-blkfront.c +0
-0@@ -912,8 +912,8 @@ out_err:return BLK_MQ_RQ_QUEUE_ERROR ;
Quoted 9 lines
drivers/block/xen-blkfront.c out_err: · line 919
Quoted 8 lines
drivers/block/xen-blkfront.c +1
-1out_busy: -spin_unlock_irqrestore (&rinfo->ring_lock, flags);blk_mq_stop_hw_queue (hctx); +spin_unlock_irqrestore (&rinfo->ring_lock, flags);return BLK_MQ_RQ_QUEUE_BUSY ; }
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 13 lines · Junxiao Bi
When ring buf full, hw queue will be stopped. While blkif interrupt consume request and make free space in ring buf, hw queue will be started again. But since start queue is protected by spin lock while stop not, that will cause a race.
interrupt: process:
blkif_interrupt()blkif_queue_rq()
kick_pending_request_queues_locked()
blk_mq_start_stopped_hw_queues()
clear_bit(BLK_MQ_S_STOPPED, &hctx->state)
blk_mq_stop_hw_queue(hctx)
blk_mq_run_hw_queue(hctx, async)
Quoted 6 lines
If ring buf is made empty in this case, interrupt will never come, then the hw queue will be stopped forever, all processes waiting for the pending io in the queue will hung.
Signed-off-by Junxiao Bi <[email protected]>Reviewed-by Ankur Arora <[email protected]>
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hi Roger,
Quoted 14 lines · Roger Pau Monné
Quoted 13 lines · Junxiao Bi
When ring buf full, hw queue will be stopped. While blkif interrupt consume request and make free space in ring buf, hw queue will be started again. But since start queue is protected by spin lock while stop not, that will cause a race.
interrupt: process:
blkif_interrupt()blkif_queue_rq()
kick_pending_request_queues_locked()
blk_mq_start_stopped_hw_queues()
clear_bit(BLK_MQ_S_STOPPED, &hctx->state)
blk_mq_stop_hw_queue(hctx)
blk_mq_run_hw_queue(hctx, async)
Quoted 8 lines
Quoted 6 lines
If ring buf is made empty in this case, interrupt will never come, then the hw queue will be stopped forever, all processes waiting for the pending io in the queue will hung.
Signed-off-by Junxiao Bi <[email protected]>Reviewed-by Ankur Arora <[email protected]>Acked-by Roger Pau Monné <[email protected]>
Looks patch not in mainline. Can you please help merge it?
Thanks,
Junxiao.
Quoted 8 lines
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 21 lines · Junxiao Bi
Hi Roger,
Quoted 18 lines · Roger Pau Monné
Quoted 17 lines · Junxiao Bi
When ring buf full, hw queue will be stopped. While blkif interrupt consume request and make free space in ring buf, hw queue will be started again. But since start queue is protected by spin lock while stop not, that will cause a race.
interrupt: process:
blkif_interrupt()blkif_queue_rq()
kick_pending_request_queues_locked()
blk_mq_start_stopped_hw_queues()
clear_bit(BLK_MQ_S_STOPPED, &hctx->state)
blk_mq_stop_hw_queue(hctx)
blk_mq_run_hw_queue(hctx, async)If ring buf is made empty in this case, interrupt will never come, then the hw queue will be stopped forever, all processes waiting for the pending io in the queue will hung.
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
Signed-off-by Junxiao Bi <[email protected]>Reviewed-by Ankur Arora <[email protected]>Acked-by Roger Pau Monné <[email protected]>Looks patch not in mainline. Can you please help merge it?
I'm afraid this needs to be done by Konrad or one of the Linux maintainers, I don't have an account on kernel.org in order to send pull requests to Jens.
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hi Konrad,
Quoted 25 lines · Roger Pau Monné
Quoted 24 lines · Junxiao Bi
Hi Roger,
Quoted 21 lines · Roger Pau Monné
Quoted 19 lines · Junxiao Bi
When ring buf full, hw queue will be stopped. While blkif interrupt consume request and make free space in ring buf, hw queue will be started again. But since start queue is protected by spin lock while stop not, that will cause a race.
interrupt: process:
blkif_interrupt()blkif_queue_rq()
kick_pending_request_queues_locked()
blk_mq_start_stopped_hw_queues()
clear_bit(BLK_MQ_S_STOPPED, &hctx->state)
blk_mq_stop_hw_queue(hctx)
blk_mq_run_hw_queue(hctx, async)If ring buf is made empty in this case, interrupt will never come, then the hw queue will be stopped forever, all processes waiting for the pending io in the queue will hung.
Signed-off-by Junxiao Bi <[email protected]>Reviewed-by Ankur Arora <[email protected]>
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
Acked-by Roger Pau Monné <[email protected]>Looks patch not in mainline. Can you please help merge it?
I'm afraid this needs to be done by Konrad or one of the Linux maintainers, I don't have an account on kernel.org in order to send pull requests to Jens.
Can you pls help merge it?
Thanks,
Junxiao.
Quoted 3 lines
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 28 lines · Junxiao Bi
Hi Konrad,
Quoted 25 lines · Roger Pau Monné
Quoted 24 lines · Junxiao Bi
Hi Roger,
Quoted 21 lines · Roger Pau Monné
Quoted 19 lines · Junxiao Bi
When ring buf full, hw queue will be stopped. While blkif interrupt consume request and make free space in ring buf, hw queue will be started again. But since start queue is protected by spin lock while stop not, that will cause a race.
interrupt: process:
blkif_interrupt()blkif_queue_rq()
kick_pending_request_queues_locked()
blk_mq_start_stopped_hw_queues()
clear_bit(BLK_MQ_S_STOPPED, &hctx->state)
blk_mq_stop_hw_queue(hctx)
blk_mq_run_hw_queue(hctx, async)If ring buf is made empty in this case, interrupt will never come, then the hw queue will be stopped forever, all processes waiting for the pending io in the queue will hung.
Signed-off-by Junxiao Bi <[email protected]>Reviewed-by Ankur Arora <[email protected]>
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
Acked-by Roger Pau Monné <[email protected]>Looks patch not in mainline. Can you please help merge it?
I'm afraid this needs to be done by Konrad or one of the Linux maintainers, I don't have an account on kernel.org in order to send pull requests to Jens.
Can you pls help merge it?
Could you kindly repost it with the updated tags _and_ against Linus's latest branch?
I get:
[konrad@char linux]$ git am -s < /tmp/a
Applying: xen-blkfront: fix mq start/stop race
error: patch failed: drivers/block/xen-blkfront.c:912
error: drivers/block/xen-blkfront.c: patch does not apply Patch failed at 0001 xen-blkfront: fix mq start/stop race The copy of the patch that failed is found in: .git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
Quoted 7 lines
Thanks,
Junxiao.Quoted 3 lines
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 32 lines · Konrad Rzeszutek Wilk
Quoted 31 lines · Junxiao Bi
Hi Konrad,
Quoted 28 lines · Roger Pau Monné
Quoted 26 lines · Junxiao Bi
Hi Roger,
Quoted 14 lines · Roger Pau Monné
Quoted 13 lines · Junxiao Bi
When ring buf full, hw queue will be stopped. While blkif interrupt consume request and make free space in ring buf, hw queue will be started again. But since start queue is protected by spin lock while stop not, that will cause a race.
interrupt: process:
blkif_interrupt()blkif_queue_rq()
kick_pending_request_queues_locked()
blk_mq_start_stopped_hw_queues()
clear_bit(BLK_MQ_S_STOPPED, &hctx->state)
blk_mq_stop_hw_queue(hctx)
blk_mq_run_hw_queue(hctx, async)Quoted 8 lines
Quoted 6 lines
If ring buf is made empty in this case, interrupt will never come, then the hw queue will be stopped forever, all processes waiting for the pending io in the queue will hung.
Signed-off-by Junxiao Bi <[email protected]>Reviewed-by Ankur Arora <[email protected]>Acked-by Roger Pau Monné <[email protected]>Looks patch not in mainline. Can you please help merge it?
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
I'm afraid this needs to be done by Konrad or one of the Linux maintainers, I don't have an account on kernel.org in order to send pull requests to Jens.
Can you pls help merge it?
Could you kindly repost it with the updated tags _and_ against Linus's latest branch?
Sure, v2 sent. Please check.
Thanks,
Junxiao.
Quoted 20 lines
I get:
[konrad@char linux]$ git am -s </tmp/a
Applying: xen-blkfront: fix mq start/stop race
error: patch failed:drivers/block/xen-blkfront.c:912
error:drivers/block/xen-blkfront.c: patch does not apply Patch failed at 0001 xen-blkfront: fix mq start/stop race The copy of the patch that failed is found in: .git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".Quoted 7 lines
Thanks,
Junxiao.Quoted 3 lines
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel