Revert "blk-mq: remove code for dealing with remapping queue"
PATCH 1/1 Revert "blk-mq: remove code for dealing with remapping queue"
This reverts commit 37c7c6c76d431dd7ef9c29d95f6052bd425f004c.
Turns out some drivers(most are FC drivers) may not use managed IRQ affinity, and has their customized .map_queues meantime, so still keep this code for avoiding regression.
--- block/blk-mq.c | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-)
block/blk-mq.c +31 -3
@@ -2407,7 +2407,7 @@ static void blk_mq_free_map_and_requests(struct blk_mq_tag_set *set,static void blk_mq_map_swqueue (struct request_queue *q) { -unsigned int i; +unsigned int i, hctx_idx;struct blk_mq_hw_ctx *hctx;struct blk_mq_ctx *ctx;struct blk_mq_tag_set *set = q->tag_set;
@@ -2424,8 +2424,23 @@ static void blk_mq_map_swqueue(struct request_queue *q)/* * Map software to hardware queues. +* +* If the cpu isn't present, the cpu is mapped to first hctx. */ for_each_possible_cpu (i) { + hctx_idx = q->mq_map[i]; +/* unmapped hw queue can be remapped after CPU topo changed */ +if (!set->tags[hctx_idx] && + !__blk_mq_alloc_rq_map (set, hctx_idx)) { +/* +* If tags initialization fail for some hctx, +* that hctx won't be brought online. In this +* case, remap the current ctx to hctx[0] which +* is guaranteed to always have tags allocated +*/ + q->mq_map[i] =0 ; + } + ctx =per_cpu_ptr (q->queue_ctx, i); hctx =blk_mq_map_queue (q, i);
@@ -2437,8 +2452,21 @@ static void blk_mq_map_swqueue(struct request_queue *q)mutex_unlock (&q->sysfs_lock);queue_for_each_hw_ctx (q, hctx, i) { -/* every hctx should get mapped by at least one CPU */ -WARN_ON (!hctx->nr_ctx); +/* +* If no software queues are mapped to this hardware queue, +* disable it and free the request entries. +*/ +if (!hctx->nr_ctx) { +/* Never unmap queue 0. We need it as a +* fallback in case of a new remap fails +* allocation +*/ +if (i && set->tags[i]) +blk_mq_free_map_and_requests (set, i); + + hctx->tags =NULL ; +continue ; + } hctx->tags = set->tags[i];WARN_ON (!hctx->tags);
Signature · 1 line
2.9.5
Quoted 87 lines · Ming Lei
This reverts commit
37c7c6c76d431dd7ef9c29d95f6052bd425f004c.Turns out some drivers(most are FC drivers) may not use managed IRQ affinity, and has their customized .map_queues meantime, so still keep this code for avoiding regression.
Reported-by Laurence Oberman <[email protected]>Cc Ewan Milne <[email protected]>Cc Stefan Haberland <[email protected]>Cc Christian Borntraeger <[email protected]>Cc Christoph Hellwig <[email protected]>Cc Sagi Grimberg <[email protected]>Signed-off-by Ming Lei <[email protected]>---
block/blk-mq.c | 34 +++++++++++++++++++++++++++++++---1 file changed, 31 insertions(+), 3 deletions(-)block/blk-mq.c +0
-0@@ -2407,7 +2407,7 @@ static void blk_mq_free_map_and_requests(struct blk_mq_tag_set *set,
static voidblk_mq_map_swqueue(struct request_queue *q){block/blk-mq.c +1
-1-unsigned int i; +unsigned int i, hctx_idx;struct
blk_mq_hw_ctx*hctx;
structblk_mq_ctx*ctx;
structblk_mq_tag_set*set =q->tag_set;block/blk-mq.c +0
-0@@ -2424,8 +2424,23 @@ static void blk_mq_map_swqueue(struct request_queue *q)
/*
* Map software to hardware queues.block/blk-mq.c +2
-0+ * + * If the cpu isn't present, the cpu is mapped to firsthctx.
*/
for_each_possible_cpu(i){block/blk-mq.c +2
-0+ hctx_idx = q->mq_map[i]; +/* unmapped hw queue can be remapped after CPU topo changed */
block/blk-mq.c +4
-0+if (!set->tags[hctx_idx] && + !__blk_mq_alloc_rq_map(set, hctx_idx)) { +/* +* If tags initialization fail for some hctx,
block/blk-mq.c +1
-0+ * that hctx won't be brought online. Inthis
block/blk-mq.c +1
-0+ * case, remap the current ctx to hctx[0]which
block/blk-mq.c +1
-0+ * is guaranteed to always have tagsallocated
block/blk-mq.c +4
-0+*/ + q->mq_map[i] =0 ; + } +ctx =
per_cpu_ptr(q->queue_ctx, i); hctx =blk_mq_map_queue(q, i);block/blk-mq.c +0
-0@@ -2437,8 +2452,21 @@ static void blk_mq_map_swqueue(struct request_queue *q) mutex_unlock(&q->sysfs_lock);
queue_for_each_hw_ctx(q, hctx, i){block/blk-mq.c +0
-1-/* every hctx should get mapped by at least one CPU */
block/blk-mq.c +2
-1-WARN_ON (!hctx->nr_ctx); +/* +* If no software queues are mapped to this hardware queue,
block/blk-mq.c +9
-0+* disable it and free the request entries. +*/ +if (!hctx->nr_ctx) { +/* Never unmap queue 0. We need it as a +* fallback in case of a new remap fails +* allocation +*/ +if (i && set->tags[i]) + blk_mq_free_map_and_requests(set,i);
block/blk-mq.c +4
-0+ + hctx->tags =NULL ; +continue ; + }
Quoted 3 lines
hctx->tags= set->tags[i];
WARN_ON(!hctx->tags);
Hello Ming
Thanks for getting this fixed so quickly.
The dumpstack is gone now of course.
Quoted 6 lines · Ming Lei
This reverts commit
37c7c6c76d431dd7ef9c29d95f6052bd425f004c.Turns out some drivers(most are FC drivers) may not use managed IRQ affinity, and has their customized .map_queues meantime, so still keep this code for avoiding regression.
Quoted 7 lines
Reported-by Laurence Oberman <[email protected]>Cc Ewan Milne <[email protected]>Cc Stefan Haberland <[email protected]>Cc Christian Borntraeger <[email protected]>Cc Christoph Hellwig <[email protected]>Cc Sagi Grimberg <[email protected]>Signed-off-by Ming Lei <[email protected]>
Seems to work ok with 4.17-rc2 + this patch with s390 and dasd devices. So one of the other fixes seems to have taken care of the original issue. Would be good if Stefan Haberland could also verify that.
Quoted 66 lines
--- block/blk-mq.c | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-)block/blk-mq.c +31
-3@@ -2407,7 +2407,7 @@ static void blk_mq_free_map_and_requests(struct blk_mq_tag_set *set,static void blk_mq_map_swqueue (struct request_queue *q) { -unsigned int i; +unsigned int i, hctx_idx;struct blk_mq_hw_ctx *hctx;struct blk_mq_ctx *ctx;struct blk_mq_tag_set *set = q->tag_set;@@ -2424,8 +2424,23 @@ static void blk_mq_map_swqueue(struct request_queue *q)/* * Map software to hardware queues. +* +* If the cpu isn't present, the cpu is mapped to first hctx. */ for_each_possible_cpu (i) { + hctx_idx = q->mq_map[i]; +/* unmapped hw queue can be remapped after CPU topo changed */ +if (!set->tags[hctx_idx] && + !__blk_mq_alloc_rq_map (set, hctx_idx)) { +/* +* If tags initialization fail for some hctx, +* that hctx won't be brought online. In this +* case, remap the current ctx to hctx[0] which +* is guaranteed to always have tags allocated +*/ + q->mq_map[i] =0 ; + } + ctx =per_cpu_ptr (q->queue_ctx, i); hctx =blk_mq_map_queue (q, i);@@ -2437,8 +2452,21 @@ static void blk_mq_map_swqueue(struct request_queue *q)mutex_unlock (&q->sysfs_lock);queue_for_each_hw_ctx (q, hctx, i) { -/* every hctx should get mapped by at least one CPU */ -WARN_ON (!hctx->nr_ctx); +/* +* If no software queues are mapped to this hardware queue, +* disable it and free the request entries. +*/ +if (!hctx->nr_ctx) { +/* Never unmap queue 0. We need it as a +* fallback in case of a new remap fails +* allocation +*/ +if (i && set->tags[i]) +blk_mq_free_map_and_requests (set, i); + + hctx->tags =NULL ; +continue ; + } hctx->tags = set->tags[i];WARN_ON (!hctx->tags);
Quoted 14 lines · Christian Borntraeger
Quoted 6 lines · Ming Lei
This reverts commit
37c7c6c76d431dd7ef9c29d95f6052bd425f004c.Turns out some drivers(most are FC drivers) may not use managed IRQ affinity, and has their customized .map_queues meantime, so still keep this code for avoiding regression.
Quoted 7 lines
Reported-by Laurence Oberman <[email protected]>Cc Ewan Milne <[email protected]>Cc Stefan Haberland <[email protected]>Cc Christian Borntraeger <[email protected]>Cc Christoph Hellwig <[email protected]>Cc Sagi Grimberg <[email protected]>Signed-off-by Ming Lei <[email protected]>
Quoted 5 lines
Seems to work ok with 4.17-rc2 + this patch with s390 and dasd devices. So one of the other fixes seems to have taken care of the original issue. Would be good if Stefan Haberland could also verify that.
Looks OK to me, too.
Did some testing with 4.17-rc2 + this patch on LPAR and z/VM with 1-65 CPUs as well as dynamic CPU definitionon z/VM and a small DASD regression test.
Jens Axboe
maintainerQuoted 21 lines · Stefan Haberland
Quoted 14 lines · Christian Borntraeger
Quoted 6 lines · Ming Lei
This reverts commit
37c7c6c76d431dd7ef9c29d95f6052bd425f004c.Turns out some drivers(most are FC drivers) may not use managed IRQ affinity, and has their customized .map_queues meantime, so still keep this code for avoiding regression.
Quoted 7 lines
Reported-by Laurence Oberman <[email protected]>Cc Ewan Milne <[email protected]>Cc Stefan Haberland <[email protected]>Cc Christian Borntraeger <[email protected]>Cc Christoph Hellwig <[email protected]>Cc Sagi Grimberg <[email protected]>Signed-off-by Ming Lei <[email protected]>Quoted 5 lines
Seems to work ok with 4.17-rc2 + this patch with s390 and dasd devices. So one of the other fixes seems to have taken care of the original issue. Would be good if Stefan Haberland could also verify that.
Quoted 4 lines
Looks OK to me, too.
Did some testing with 4.17-rc2 + this patch on LPAR and z/VM with 1-65 CPUs as
well as dynamic CPU definitionon z/VM and a small DASD regression test.
For both you and Christian - it'd be really nice if those positive test results could be included in the forms of a Tested-by or similar in the patch itself.
Signature · 1 line
Jens Axboe
Christian Borntraeger
Tested-byQuoted 22 lines · Jens Axboe
Quoted 21 lines · Stefan Haberland
Quoted 19 lines · Christian Borntraeger
Quoted 6 lines · Ming Lei
This reverts commit
37c7c6c76d431dd7ef9c29d95f6052bd425f004c.Turns out some drivers(most are FC drivers) may not use managed IRQ affinity, and has their customized .map_queues meantime, so still keep this code for avoiding regression.
Quoted 7 lines
Reported-by Laurence Oberman <[email protected]>Cc Ewan Milne <[email protected]>Cc Stefan Haberland <[email protected]>Cc Christian Borntraeger <[email protected]>Cc Christoph Hellwig <[email protected]>Cc Sagi Grimberg <[email protected]>Signed-off-by Ming Lei <[email protected]>Seems to work ok with 4.17-rc2 + this patch with s390 and dasd devices. So one of the other fixes seems to have taken care of the original issue. Would be good if Stefan Haberland could also verify that.
Quoted 9 lines
Quoted 4 lines
Looks OK to me, too.
Did some testing with 4.17-rc2 + this patch on LPAR and z/VM with 1-65 CPUs as
well as dynamic CPU definitionon z/VM and a small DASD regression test.For both you and Christian - it'd be really nice if those positive test results could be included in the forms of a Tested-by or similar in the patch itself.
Quoted 6 lines · Ming Lei
This reverts commit
37c7c6c76d431dd7ef9c29d95f6052bd425f004c.Turns out some drivers(most are FC drivers) may not use managed IRQ affinity, and has their customized .map_queues meantime, so still keep this code for avoiding regression.
Quoted 9 lines
Reported-by Laurence Oberman <[email protected]>Cc Ewan Milne <[email protected]>Cc Stefan Haberland <[email protected]>Cc Christian Borntraeger <[email protected]>Cc Christoph Hellwig <[email protected]>Cc Sagi Grimberg <[email protected]>Signed-off-by Ming Lei <[email protected]>---
Quoted 5 lines · Ming Lei
This reverts commit
37c7c6c76d431dd7ef9c29d95f6052bd425f004c.Turns out some drivers(most are FC drivers) may not use managed IRQ affinity, and has their customized .map_queues meantime, so still keep this code for avoiding regression.
Applied, thanks.
Signature · 1 line
Jens Axboe