[PATCH] nvme-pci: allocate tagset on reset if necessary

Keith Busch kbusch at meta.com
Mon Aug 26 11:27:19 PDT 2024


From: Keith Busch <kbusch at kernel.org>

If a drive is unable to create IO queues on the initial probe, a
subsequent reset will need to allocate the tagset if IO queue creation
is successful.

Signed-off-by: Keith Busch <kbusch at kernel.org>
---
 drivers/nvme/host/pci.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 6cd9395ba9ec3..8e280e13cf10d 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2508,9 +2508,14 @@ static unsigned int nvme_pci_nr_maps(struct nvme_dev *dev)
 
 static void nvme_pci_update_nr_queues(struct nvme_dev *dev)
 {
-	blk_mq_update_nr_hw_queues(&dev->tagset, dev->online_queues - 1);
-	/* free previously allocated queues that are no longer usable */
-	nvme_free_queues(dev, dev->online_queues);
+	if (!dev->ctrl.tagset) {
+		nvme_alloc_io_tag_set(&dev->ctrl, &dev->tagset, &nvme_mq_ops,
+				nvme_pci_nr_maps(dev), sizeof(struct nvme_iod));
+	} else {
+		blk_mq_update_nr_hw_queues(&dev->tagset, dev->online_queues - 1);
+		/* free previously allocated queues that are no longer usable */
+		nvme_free_queues(dev, dev->online_queues);
+	}
 }
 
 static int nvme_pci_enable(struct nvme_dev *dev)
-- 
2.43.5




More information about the Linux-nvme mailing list