[PATCH 1/4] nvme: fix setting the queue depth in nvme_alloc_io_tag_set
Sagi Grimberg
sagi at grimberg.me
Sun Dec 25 02:51:34 PST 2022
> While the CAP.MQES field in NVMe is a 0s based filed with a natural one
> off, we also need to account for the queue wrap condition and fix undo
> the one off again in nvme_alloc_io_tag_set. This was never properly
> done by the fabrics drivers, but they don't seem to care because there
> is no actual physical queue that can wrap around, but it became a
> problem when converting over the PCIe driver. Also add back the
> BLK_MQ_MAX_DEPTH check that was lost in the same commit.
>
> Fixes: 0da7feaa5913 ("nvme-pci: use the tagset alloc/free helpers")
This looks fine, but does this actually fix anything?
How does nvme-pci ever set sqsize anywhere close to BLK_MQ_MAX_DEPTH ?
NVME_PCI_MAX_QUEUE_SIZE is 4095...
> Reported-by: Hugh Dickins <hughd at google.com>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
> drivers/nvme/host/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index e26b085a007aea..cda1361e6d4fbb 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -4897,7 +4897,7 @@ int nvme_alloc_io_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
>
> memset(set, 0, sizeof(*set));
> set->ops = ops;
> - set->queue_depth = ctrl->sqsize + 1;
> + set->queue_depth = min_t(unsigned, ctrl->sqsize, BLK_MQ_MAX_DEPTH - 1);
> /*
> * Some Apple controllers requires tags to be unique across admin and
> * the (only) I/O queue, so reserve the first 32 tags of the I/O queue.
More information about the Linux-nvme
mailing list