blk-mq: only dispatch to non-defauly queue maps if they have queues
Subsystems (2)
Christoph Hellwig
maintainerPATCH 1/2 blk-mq: only dispatch to non-defauly queue maps if they have queues
We should check if a given queue map actually has queues enabled before dispatching to it. This allows drivers to not initialize optional but not used map types, which subsequently will allow fixing problems with queue map rebuilds for that case.
--- block/blk-mq.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
block/blk-mq.h +8 -5
@@ -105,14 +105,17 @@ static inline struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *q, {enum hctx_type type =HCTX_TYPE_DEFAULT ; -if (q->tag_set->nr_maps >HCTX_TYPE_POLL && - ((flags &REQ_HIPRI ) &&test_bit (QUEUE_FLAG_POLL , &q->queue_flags))) +if ((flags &REQ_HIPRI ) && + q->tag_set->nr_maps >HCTX_TYPE_POLL && + q->tag_set->map[HCTX_TYPE_POLL ].nr_queues && +test_bit (QUEUE_FLAG_POLL , &q->queue_flags)) type =HCTX_TYPE_POLL ; -else if (q->tag_set->nr_maps >HCTX_TYPE_READ && - ((flags &REQ_OP_MASK ) ==REQ_OP_READ )) +else if (((flags &REQ_OP_MASK ) ==REQ_OP_READ ) && + q->tag_set->nr_maps >HCTX_TYPE_READ && + q->tag_set->map[HCTX_TYPE_READ ].nr_queues) type =HCTX_TYPE_READ ; - +return blk_mq_map_queue_type (q, type, cpu); }
Signature · 1 line
2.19.2
Christoph Hellwig
maintainerPATCH 2/2 nvme-pci: don't share queue maps
Now that the block layer checks if a queue map has any queues inside it there is no more reason to duplicate the maps for the non-default types.
--- drivers/nvme/host/pci.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/nvme/host/pci.c +1 -5
@@ -496,11 +496,7 @@ static int nvme_pci_map_queues(struct blk_mq_tag_set *set) map->nr_queues = dev->io_queues[i];if (!map->nr_queues) {BUG_ON (i ==HCTX_TYPE_DEFAULT ); - -/* shared set, resuse read set parameters */ - map->nr_queues = dev->io_queues[HCTX_TYPE_DEFAULT ]; - qoff =0 ; - offset =queue_irq_offset (dev); +continue ; }/*
Signature · 1 line
2.19.2
Quoted 26 lines · Christoph Hellwig
We should check if a given queue map actually has queues enabled before dispatching to it. This allows drivers to not initialize optional but not used map types, which subsequently will allow fixing problems with queue map rebuilds for that case.
Signed-off-by Christoph Hellwig <hch at lst.de>--- block/blk-mq.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)block/blk-mq.h +4
-2@@ -105,14 +105,17 @@ static inline struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *q, {enum hctx_type type =HCTX_TYPE_DEFAULT ; -if (q->tag_set->nr_maps >HCTX_TYPE_POLL && - ((flags &REQ_HIPRI ) &&test_bit (QUEUE_FLAG_POLL , &q->queue_flags))) +if ((flags &REQ_HIPRI ) && + q->tag_set->nr_maps >HCTX_TYPE_POLL && + q->tag_set->map[HCTX_TYPE_POLL ].nr_queues && +test_bit (QUEUE_FLAG_POLL , &q->queue_flags)) type =HCTX_TYPE_POLL ;
block/blk-mq.h static inline struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *q, · line 120
Quoted 10 lines
block/blk-mq.h +4
-3-else if (q->tag_set->nr_maps >HCTX_TYPE_READ && - ((flags &REQ_OP_MASK ) ==REQ_OP_READ )) +else if (((flags &REQ_OP_MASK ) ==REQ_OP_READ ) && + q->tag_set->nr_maps >HCTX_TYPE_READ && + q->tag_set->map[HCTX_TYPE_READ ].nr_queues) type =HCTX_TYPE_READ ; - +return blk_mq_map_queue_type (q, type, cpu); }
Thanks,
Ming
Re: [PATCH 2/2] nvme-pci: don't share queue maps
In reply to Christoph HellwigQuoted 29 lines · Christoph Hellwig
Now that the block layer checks if a queue map has any queues inside it there is no more reason to duplicate the maps for the non-default types.
Signed-off-by Christoph Hellwig <hch at lst.de>--- drivers/nvme/host/pci.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)drivers/nvme/host/pci.c +1
-5@@ -496,11 +496,7 @@ static int nvme_pci_map_queues(struct blk_mq_tag_set *set) map->nr_queues = dev->io_queues[i];if (!map->nr_queues) {BUG_ON (i ==HCTX_TYPE_DEFAULT ); - -/* shared set, resuse read set parameters */ - map->nr_queues = dev->io_queues[HCTX_TYPE_DEFAULT ]; - qoff =0 ; - offset =queue_irq_offset (dev); +continue ; }/* Signature · 1 line
2.19.2
Thanks,
Ming
Quoted 4 lines · Christoph Hellwig
We should check if a given queue map actually has queues enabled before dispatching to it. This allows drivers to not initialize optional but not used map types, which subsequently will allow fixing problems with queue map rebuilds for that case.
Applied, thanks.
Signature · 1 line
Jens Axboe
Re: [PATCH 2/2] nvme-pci: don't share queue maps
In reply to Christoph HellwigQuoted 3 lines · Christoph Hellwig
Now that the block layer checks if a queue map has any queues inside it there is no more reason to duplicate the maps for the non-default types.
Applied, thanks.
Signature · 1 line
Jens Axboe