* [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* Re: [PATCH] nvme-pci: allocate tagset on reset if necessary
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
1 sibling, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2024-08-27 5:49 UTC (permalink / raw)
To: Keith Busch; +Cc: linux-nvme, hch, sagi, Keith Busch
On Mon, Aug 26, 2024 at 11:27:19AM -0700, Keith Busch wrote:
> + 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);
Overly long line here. Maybe just return early after the allocation
above?
Otherwise looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] nvme-pci: allocate tagset on reset if necessary
2024-08-27 5:49 ` Christoph Hellwig
@ 2024-08-27 14:57 ` Keith Busch
0 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2024-08-27 14:57 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Keith Busch, linux-nvme, sagi
On Tue, Aug 27, 2024 at 07:49:23AM +0200, Christoph Hellwig wrote:
> On Mon, Aug 26, 2024 at 11:27:19AM -0700, Keith Busch wrote:
> > + 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);
>
> Overly long line here. Maybe just return early after the allocation
> above?
Done.
I think I should also add more details to the change log because this
bug does cause a kernel crash. I think this is the first commit that
removed tagset allocation from reset_work:
Fixes: eac3ef262941f62 ("nvme-pci: split the initial probe from the rest path")
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nvme-pci: allocate tagset on reset if necessary
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 8:13 ` Sagi Grimberg
1 sibling, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2024-08-27 8:13 UTC (permalink / raw)
To: Keith Busch, linux-nvme, hch; +Cc: Keith Busch
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [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