All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-pci: only set nr_maps to 2 if poll queues are supported
@ 2018-12-14 15:42 Christoph Hellwig
  2018-12-14 15:45 ` Jens Axboe
  0 siblings, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2018-12-14 15:42 UTC (permalink / raw)


The block layer now enables polling support on a queue if nr_maps
includes the poll map, so we should only set that if we actually
support poll queues.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/host/pci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index fb9d8270f32c..8b62d0075e48 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2293,6 +2293,9 @@ static int nvme_dev_add(struct nvme_dev *dev)
 	if (!dev->ctrl.tagset) {
 		dev->tagset.ops = &nvme_mq_ops;
 		dev->tagset.nr_hw_queues = dev->online_queues - 1;
+		dev->tagset.nr_maps = 2; /* default + read */
+		if (dev->io_queues[HCTX_TYPE_POLL])
+			dev->tagset.nr_maps++;
 		dev->tagset.nr_maps = HCTX_MAX_TYPES;
 		dev->tagset.timeout = NVME_IO_TIMEOUT;
 		dev->tagset.numa_node = dev_to_node(dev->dev);
-- 
2.19.2

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

* [PATCH] nvme-pci: only set nr_maps to 2 if poll queues are supported
  2018-12-14 15:42 [PATCH] nvme-pci: only set nr_maps to 2 if poll queues are supported Christoph Hellwig
@ 2018-12-14 15:45 ` Jens Axboe
  0 siblings, 0 replies; 12+ messages in thread
From: Jens Axboe @ 2018-12-14 15:45 UTC (permalink / raw)


On 12/14/18 8:42 AM, Christoph Hellwig wrote:
> The block layer now enables polling support on a queue if nr_maps
> includes the poll map, so we should only set that if we actually
> support poll queues.

Looks good to me, but needs a Fixes line.

-- 
Jens Axboe

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

* [PATCH] nvme-pci: only set nr_maps to 2 if poll queues are supported
  2018-12-14 16:20 Christoph Hellwig
  2018-12-14 16:47 ` Jens Axboe
  2018-12-14 18:43 ` Sagi Grimberg
@ 2018-12-15  1:14 ` Sagi Grimberg
  2 siblings, 0 replies; 12+ messages in thread
From: Sagi Grimberg @ 2018-12-15  1:14 UTC (permalink / raw)


Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

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

* [PATCH] nvme-pci: only set nr_maps to 2 if poll queues are supported
  2018-12-14 19:36       ` Jens Axboe
@ 2018-12-14 19:49         ` Sagi Grimberg
  0 siblings, 0 replies; 12+ messages in thread
From: Sagi Grimberg @ 2018-12-14 19:49 UTC (permalink / raw)



>>> since the core doesn't have any notion of how many queues are used for
>>> what. We only support polling if you have explicit poll queues now,
>>> hence the above is wrong if nvme says nr_maps is 3 and it doesn't have
>>> any poll queues.
>>
>> Yea, but its not broken because the map shares the default queue map
>> right? Just wanted to understand if something is broken rather than just
>> wrong.
> 
> It's broken since we say we support polling by setting the QUEUE_FLAG_POLL
> flag, but we do not. It's not broken in terms of maps on the nvme side.
> As you mention, the map sharing means it's perfectly legit to not have
> special queues for each map. Polling is just special since we absolutely
> do require special poll queues without interrupts. It's not like reads
> vs writes, where we can share and nobody cares.

Yea... I fixed that for rdma as well..

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

* [PATCH] nvme-pci: only set nr_maps to 2 if poll queues are supported
  2018-12-14 19:01     ` Sagi Grimberg
@ 2018-12-14 19:36       ` Jens Axboe
  2018-12-14 19:49         ` Sagi Grimberg
  0 siblings, 1 reply; 12+ messages in thread
From: Jens Axboe @ 2018-12-14 19:36 UTC (permalink / raw)


On 12/14/18 12:01 PM, Sagi Grimberg wrote:
> 
>>>> The block layer now enables polling support on a queue if nr_maps
>>>> includes the poll map, so we should only set that if we actually
>>>> support poll queues.
>>>>
>>>> Fixes:  6544d229bf ("block: enable polling by default if a poll map is initalized")
>>>
>>> What does it fix? is there a bug when setting 3 queue maps?
>>
>> After the recent changes, blk_mq_init_allocated_queue() does this:
>>
>> if (set->nr_maps > HCTX_TYPE_POLL)
>> 	blk_queue_flag_set(QUEUE_FLAG_POLL, q);
>>
>> since the core doesn't have any notion of how many queues are used for
>> what. We only support polling if you have explicit poll queues now,
>> hence the above is wrong if nvme says nr_maps is 3 and it doesn't have
>> any poll queues.
> 
> Yea, but its not broken because the map shares the default queue map
> right? Just wanted to understand if something is broken rather than just
> wrong.

It's broken since we say we support polling by setting the QUEUE_FLAG_POLL
flag, but we do not. It's not broken in terms of maps on the nvme side.
As you mention, the map sharing means it's perfectly legit to not have
special queues for each map. Polling is just special since we absolutely
do require special poll queues without interrupts. It's not like reads
vs writes, where we can share and nobody cares.

-- 
Jens Axboe

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

* [PATCH] nvme-pci: only set nr_maps to 2 if poll queues are supported
  2018-12-14 18:50   ` Jens Axboe
@ 2018-12-14 19:01     ` Sagi Grimberg
  2018-12-14 19:36       ` Jens Axboe
  0 siblings, 1 reply; 12+ messages in thread
From: Sagi Grimberg @ 2018-12-14 19:01 UTC (permalink / raw)



>>> The block layer now enables polling support on a queue if nr_maps
>>> includes the poll map, so we should only set that if we actually
>>> support poll queues.
>>>
>>> Fixes:  6544d229bf ("block: enable polling by default if a poll map is initalized")
>>
>> What does it fix? is there a bug when setting 3 queue maps?
> 
> After the recent changes, blk_mq_init_allocated_queue() does this:
> 
> if (set->nr_maps > HCTX_TYPE_POLL)
> 	blk_queue_flag_set(QUEUE_FLAG_POLL, q);
> 
> since the core doesn't have any notion of how many queues are used for
> what. We only support polling if you have explicit poll queues now,
> hence the above is wrong if nvme says nr_maps is 3 and it doesn't have
> any poll queues.

Yea, but its not broken because the map shares the default queue map
right? Just wanted to understand if something is broken rather than just
wrong.

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

* [PATCH] nvme-pci: only set nr_maps to 2 if poll queues are supported
  2018-12-14 18:43 ` Sagi Grimberg
@ 2018-12-14 18:50   ` Jens Axboe
  2018-12-14 19:01     ` Sagi Grimberg
  0 siblings, 1 reply; 12+ messages in thread
From: Jens Axboe @ 2018-12-14 18:50 UTC (permalink / raw)


On 12/14/18 11:43 AM, Sagi Grimberg wrote:
> 
>> The block layer now enables polling support on a queue if nr_maps
>> includes the poll map, so we should only set that if we actually
>> support poll queues.
>>
>> Fixes:  6544d229bf ("block: enable polling by default if a poll map is initalized")
> 
> What does it fix? is there a bug when setting 3 queue maps?

After the recent changes, blk_mq_init_allocated_queue() does this:

if (set->nr_maps > HCTX_TYPE_POLL)
	blk_queue_flag_set(QUEUE_FLAG_POLL, q);

since the core doesn't have any notion of how many queues are used for
what. We only support polling if you have explicit poll queues now,
hence the above is wrong if nvme says nr_maps is 3 and it doesn't have
any poll queues.

-- 
Jens Axboe

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

* [PATCH] nvme-pci: only set nr_maps to 2 if poll queues are supported
  2018-12-14 16:20 Christoph Hellwig
  2018-12-14 16:47 ` Jens Axboe
@ 2018-12-14 18:43 ` Sagi Grimberg
  2018-12-14 18:50   ` Jens Axboe
  2018-12-15  1:14 ` Sagi Grimberg
  2 siblings, 1 reply; 12+ messages in thread
From: Sagi Grimberg @ 2018-12-14 18:43 UTC (permalink / raw)



> The block layer now enables polling support on a queue if nr_maps
> includes the poll map, so we should only set that if we actually
> support poll queues.
> 
> Fixes:  6544d229bf ("block: enable polling by default if a poll map is initalized")

What does it fix? is there a bug when setting 3 queue maps?

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

* [PATCH] nvme-pci: only set nr_maps to 2 if poll queues are supported
  2018-12-14 16:49   ` Christoph Hellwig
@ 2018-12-14 16:49     ` Jens Axboe
  0 siblings, 0 replies; 12+ messages in thread
From: Jens Axboe @ 2018-12-14 16:49 UTC (permalink / raw)


On 12/14/18 9:49 AM, Christoph Hellwig wrote:
> On Fri, Dec 14, 2018@09:47:38AM -0700, Jens Axboe wrote:
>> On 12/14/18 9:20 AM, Christoph Hellwig wrote:
>>> The block layer now enables polling support on a queue if nr_maps
>>> includes the poll map, so we should only set that if we actually
>>> support poll queues.
>>
>> Looks good to me. Do you want to carry it? If so:
>>
>> Reviewed-by: Jens Axboe <axboe at kernel.dk>
>>
>> or I can take it directly. Let me know.
> 
> I can carry it, we've get a few more nvme bits piling up anyway.

Sounds good, thanks.

-- 
Jens Axboe

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

* [PATCH] nvme-pci: only set nr_maps to 2 if poll queues are supported
  2018-12-14 16:47 ` Jens Axboe
@ 2018-12-14 16:49   ` Christoph Hellwig
  2018-12-14 16:49     ` Jens Axboe
  0 siblings, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2018-12-14 16:49 UTC (permalink / raw)


On Fri, Dec 14, 2018@09:47:38AM -0700, Jens Axboe wrote:
> On 12/14/18 9:20 AM, Christoph Hellwig wrote:
> > The block layer now enables polling support on a queue if nr_maps
> > includes the poll map, so we should only set that if we actually
> > support poll queues.
> 
> Looks good to me. Do you want to carry it? If so:
> 
> Reviewed-by: Jens Axboe <axboe at kernel.dk>
> 
> or I can take it directly. Let me know.

I can carry it, we've get a few more nvme bits piling up anyway.

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

* [PATCH] nvme-pci: only set nr_maps to 2 if poll queues are supported
  2018-12-14 16:20 Christoph Hellwig
@ 2018-12-14 16:47 ` Jens Axboe
  2018-12-14 16:49   ` Christoph Hellwig
  2018-12-14 18:43 ` Sagi Grimberg
  2018-12-15  1:14 ` Sagi Grimberg
  2 siblings, 1 reply; 12+ messages in thread
From: Jens Axboe @ 2018-12-14 16:47 UTC (permalink / raw)


On 12/14/18 9:20 AM, Christoph Hellwig wrote:
> The block layer now enables polling support on a queue if nr_maps
> includes the poll map, so we should only set that if we actually
> support poll queues.

Looks good to me. Do you want to carry it? If so:

Reviewed-by: Jens Axboe <axboe at kernel.dk>

or I can take it directly. Let me know.

-- 
Jens Axboe

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

* [PATCH] nvme-pci: only set nr_maps to 2 if poll queues are supported
@ 2018-12-14 16:20 Christoph Hellwig
  2018-12-14 16:47 ` Jens Axboe
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Christoph Hellwig @ 2018-12-14 16:20 UTC (permalink / raw)


The block layer now enables polling support on a queue if nr_maps
includes the poll map, so we should only set that if we actually
support poll queues.

Fixes:  6544d229bf ("block: enable polling by default if a poll map is initalized")
Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/host/pci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index fb9d8270f32c..8b62d0075e48 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2293,6 +2293,9 @@ static int nvme_dev_add(struct nvme_dev *dev)
 	if (!dev->ctrl.tagset) {
 		dev->tagset.ops = &nvme_mq_ops;
 		dev->tagset.nr_hw_queues = dev->online_queues - 1;
+		dev->tagset.nr_maps = 2; /* default + read */
+		if (dev->io_queues[HCTX_TYPE_POLL])
+			dev->tagset.nr_maps++;
 		dev->tagset.nr_maps = HCTX_MAX_TYPES;
 		dev->tagset.timeout = NVME_IO_TIMEOUT;
 		dev->tagset.numa_node = dev_to_node(dev->dev);
-- 
2.19.2

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

end of thread, other threads:[~2018-12-15  1:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-14 15:42 [PATCH] nvme-pci: only set nr_maps to 2 if poll queues are supported Christoph Hellwig
2018-12-14 15:45 ` Jens Axboe
2018-12-14 16:20 Christoph Hellwig
2018-12-14 16:47 ` Jens Axboe
2018-12-14 16:49   ` Christoph Hellwig
2018-12-14 16:49     ` Jens Axboe
2018-12-14 18:43 ` Sagi Grimberg
2018-12-14 18:50   ` Jens Axboe
2018-12-14 19:01     ` Sagi Grimberg
2018-12-14 19:36       ` Jens Axboe
2018-12-14 19:49         ` Sagi Grimberg
2018-12-15  1:14 ` Sagi Grimberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.