linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] blk-mq: only dispatch to non-defauly queue maps if they have queues
@ 2018-12-17 11:16 Christoph Hellwig
  2018-12-17 11:16 ` [PATCH 2/2] nvme-pci: don't share queue maps Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Christoph Hellwig @ 2018-12-17 11:16 UTC (permalink / raw)
  To: axboe; +Cc: ming.lei, linux-block, linux-nvme

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@lst.de>
---
 block/blk-mq.h | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/block/blk-mq.h b/block/blk-mq.h
index b63a0de8a07a..d1ed096723fb 100644
--- a/block/blk-mq.h
+++ b/block/blk-mq.h
@@ -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);
 }
 
-- 
2.19.2


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

* [PATCH 2/2] nvme-pci: don't share queue maps
  2018-12-17 11:16 [PATCH 1/2] blk-mq: only dispatch to non-defauly queue maps if they have queues Christoph Hellwig
@ 2018-12-17 11:16 ` Christoph Hellwig
  2018-12-17 11:24   ` Ming Lei
  2018-12-17 12:56   ` Jens Axboe
  2018-12-17 11:23 ` [PATCH 1/2] blk-mq: only dispatch to non-defauly queue maps if they have queues Ming Lei
  2018-12-17 12:56 ` Jens Axboe
  2 siblings, 2 replies; 6+ messages in thread
From: Christoph Hellwig @ 2018-12-17 11:16 UTC (permalink / raw)
  To: axboe; +Cc: ming.lei, linux-block, linux-nvme

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@lst.de>
---
 drivers/nvme/host/pci.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index fb9d8270f32c..698b350b38cf 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -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;
 		}
 
 		/*
-- 
2.19.2


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

* Re: [PATCH 1/2] blk-mq: only dispatch to non-defauly queue maps if they have queues
  2018-12-17 11:16 [PATCH 1/2] blk-mq: only dispatch to non-defauly queue maps if they have queues Christoph Hellwig
  2018-12-17 11:16 ` [PATCH 2/2] nvme-pci: don't share queue maps Christoph Hellwig
@ 2018-12-17 11:23 ` Ming Lei
  2018-12-17 12:56 ` Jens Axboe
  2 siblings, 0 replies; 6+ messages in thread
From: Ming Lei @ 2018-12-17 11:23 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: axboe, linux-block, linux-nvme

On Mon, Dec 17, 2018 at 12:16:26PM +0100, Christoph Hellwig wrote:
> 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@lst.de>
> ---
>  block/blk-mq.h | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/block/blk-mq.h b/block/blk-mq.h
> index b63a0de8a07a..d1ed096723fb 100644
> --- a/block/blk-mq.h
> +++ b/block/blk-mq.h
> @@ -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);
>  }

Reviewed-by: Ming Lei <ming.lei@redhat.com>

Thanks,
Ming

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

* Re: [PATCH 2/2] nvme-pci: don't share queue maps
  2018-12-17 11:16 ` [PATCH 2/2] nvme-pci: don't share queue maps Christoph Hellwig
@ 2018-12-17 11:24   ` Ming Lei
  2018-12-17 12:56   ` Jens Axboe
  1 sibling, 0 replies; 6+ messages in thread
From: Ming Lei @ 2018-12-17 11:24 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: axboe, linux-block, linux-nvme

On Mon, Dec 17, 2018 at 12:16:27PM +0100, Christoph Hellwig wrote:
> 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@lst.de>
> ---
>  drivers/nvme/host/pci.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index fb9d8270f32c..698b350b38cf 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -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;
>  		}
>  
>  		/*
> -- 
> 2.19.2
> 

Reviewed-by: Ming Lei <ming.lei@redhat.com>

Thanks,
Ming

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

* Re: [PATCH 1/2] blk-mq: only dispatch to non-defauly queue maps if they have queues
  2018-12-17 11:16 [PATCH 1/2] blk-mq: only dispatch to non-defauly queue maps if they have queues Christoph Hellwig
  2018-12-17 11:16 ` [PATCH 2/2] nvme-pci: don't share queue maps Christoph Hellwig
  2018-12-17 11:23 ` [PATCH 1/2] blk-mq: only dispatch to non-defauly queue maps if they have queues Ming Lei
@ 2018-12-17 12:56 ` Jens Axboe
  2 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2018-12-17 12:56 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: ming.lei, linux-block, linux-nvme

On 12/17/18 4:16 AM, Christoph Hellwig wrote:
> 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.


-- 
Jens Axboe


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

* Re: [PATCH 2/2] nvme-pci: don't share queue maps
  2018-12-17 11:16 ` [PATCH 2/2] nvme-pci: don't share queue maps Christoph Hellwig
  2018-12-17 11:24   ` Ming Lei
@ 2018-12-17 12:56   ` Jens Axboe
  1 sibling, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2018-12-17 12:56 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: ming.lei, linux-block, linux-nvme

On 12/17/18 4:16 AM, Christoph Hellwig wrote:
> 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.

-- 
Jens Axboe


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

end of thread, other threads:[~2018-12-17 12:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-17 11:16 [PATCH 1/2] blk-mq: only dispatch to non-defauly queue maps if they have queues Christoph Hellwig
2018-12-17 11:16 ` [PATCH 2/2] nvme-pci: don't share queue maps Christoph Hellwig
2018-12-17 11:24   ` Ming Lei
2018-12-17 12:56   ` Jens Axboe
2018-12-17 11:23 ` [PATCH 1/2] blk-mq: only dispatch to non-defauly queue maps if they have queues Ming Lei
2018-12-17 12:56 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).