From: Keith Busch <kbusch@meta.com>
To: <linux-nvme@lists.infradead.org>, <hch@lst.de>
Cc: Keith Busch <kbusch@kernel.org>
Subject: [PATCH 2/3] nvme-pci: cap queue creation to used queues
Date: Tue, 10 Feb 2026 11:37:14 -0800 [thread overview]
Message-ID: <20260210193715.2543091-2-kbusch@meta.com> (raw)
In-Reply-To: <20260210193715.2543091-1-kbusch@meta.com>
From: Keith Busch <kbusch@kernel.org>
If the user reduces the special queue count at runtime and resets the
controller, we need to reduce the number of queues and interrupts
requested accordingly rather than start with the pre-allocated queue
count.
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
drivers/nvme/host/pci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 5a3e27305176f..f6d5c242fb689 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2775,7 +2775,8 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
dev->nr_write_queues = write_queues;
dev->nr_poll_queues = poll_queues;
- nr_io_queues = dev->nr_allocated_queues - 1;
+ nr_io_queues = min(nvme_max_io_queues(dev),
+ dev->nr_allocated_queues - 1);
result = nvme_set_queue_count(&dev->ctrl, &nr_io_queues);
if (result < 0)
return result;
--
2.47.3
next prev parent reply other threads:[~2026-02-10 19:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-10 19:37 [PATCH 1/3] nvme-pci: ensure we're polling a polled queue Keith Busch
2026-02-10 19:37 ` Keith Busch [this message]
2026-02-11 15:56 ` [PATCH 2/3] nvme-pci: cap queue creation to used queues Christoph Hellwig
2026-02-12 14:57 ` Kanchan Joshi
2026-02-10 19:37 ` [PATCH 3/3] nvme-pci: do not try to add queue maps at runtime Keith Busch
2026-02-11 15:58 ` Christoph Hellwig
2026-02-11 15:56 ` [PATCH 1/3] nvme-pci: ensure we're polling a polled queue Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260210193715.2543091-2-kbusch@meta.com \
--to=kbusch@meta.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox