Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-pci: allocate tagset on reset if necessary
@ 2024-08-26 18:27 Keith Busch
  2024-08-27  5:49 ` Christoph Hellwig
  2024-08-27  8:13 ` Sagi Grimberg
  0 siblings, 2 replies; 4+ messages in thread
From: Keith Busch @ 2024-08-26 18:27 UTC (permalink / raw)
  To: linux-nvme, hch; +Cc: sagi, Keith Busch

From: Keith Busch <kbusch@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@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



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

end of thread, other threads:[~2024-08-27 14:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-26 18:27 [PATCH] nvme-pci: allocate tagset on reset if necessary Keith Busch
2024-08-27  5:49 ` Christoph Hellwig
2024-08-27 14:57   ` Keith Busch
2024-08-27  8:13 ` Sagi Grimberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox