public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Jens Axboe <axboe@fb.com>
Cc: Keith Busch <kbusch@kernel.org>, Sagi Grimberg <sagi@grimberg.me>,
	Hugh Dickins <hughd@google.com>,
	linux-nvme@lists.infradead.org
Subject: [PATCH 2/4] nvme-pci: update sqsize when adjusting the queue depth
Date: Sun, 25 Dec 2022 11:32:32 +0100	[thread overview]
Message-ID: <20221225103234.226794-3-hch@lst.de> (raw)
In-Reply-To: <20221225103234.226794-1-hch@lst.de>

Update the core sqsize field in addition to the PCIe-specific
q_depth field as the core tagset allocation helpers rely on it.

Fixes: 0da7feaa5913 ("nvme-pci: use the tagset alloc/free helpers")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/pci.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 804b6a6cb43a9c..b13baccedb4a95 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2333,10 +2333,12 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
 	if (dev->cmb_use_sqes) {
 		result = nvme_cmb_qdepth(dev, nr_io_queues,
 				sizeof(struct nvme_command));
-		if (result > 0)
+		if (result > 0) {
 			dev->q_depth = result;
-		else
+			dev->ctrl.sqsize = result - 1;
+		} else {
 			dev->cmb_use_sqes = false;
+		}
 	}
 
 	do {
@@ -2537,7 +2539,6 @@ static int nvme_pci_enable(struct nvme_dev *dev)
 
 	dev->q_depth = min_t(u32, NVME_CAP_MQES(dev->ctrl.cap) + 1,
 				io_queue_depth);
-	dev->ctrl.sqsize = dev->q_depth - 1; /* 0's based queue depth */
 	dev->db_stride = 1 << NVME_CAP_STRIDE(dev->ctrl.cap);
 	dev->dbs = dev->bar + 4096;
 
@@ -2578,7 +2579,7 @@ static int nvme_pci_enable(struct nvme_dev *dev)
 		dev_warn(dev->ctrl.device, "IO queue depth clamped to %d\n",
 			 dev->q_depth);
 	}
-
+	dev->ctrl.sqsize = dev->q_depth - 1; /* 0's based queue depth */
 
 	nvme_map_cmb(dev);
 
-- 
2.35.1



  parent reply	other threads:[~2022-12-25 11:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-25 10:32 fix nvme sqsize on off regression Christoph Hellwig
2022-12-25 10:32 ` [PATCH 1/4] nvme: fix setting the queue depth in nvme_alloc_io_tag_set Christoph Hellwig
2022-12-25 10:51   ` Sagi Grimberg
2022-12-25 10:53     ` Sagi Grimberg
2022-12-28 16:11       ` Christoph Hellwig
2022-12-25 21:15   ` Hugh Dickins
2022-12-25 10:32 ` Christoph Hellwig [this message]
2022-12-25 11:19   ` [PATCH 2/4] nvme-pci: update sqsize when adjusting the queue depth Sagi Grimberg
2022-12-28 16:10     ` Christoph Hellwig
2022-12-29 12:07       ` Sagi Grimberg
2022-12-29 16:34         ` Keith Busch
2023-01-02  9:39           ` Sagi Grimberg
2023-01-03 16:45             ` Keith Busch
2022-12-25 21:21   ` Hugh Dickins
2022-12-25 10:32 ` [PATCH 3/4] nvme: store the actual queue size in ctrl->sqsize Christoph Hellwig
2022-12-25 11:09   ` Sagi Grimberg
2022-12-28 17:02   ` Keith Busch
2022-12-25 10:32 ` [PATCH 4/4] nvme-pci: remove the dev->q_depth field Christoph Hellwig
2022-12-25 11:19   ` Sagi Grimberg
2022-12-26 19:11 ` (subset) fix nvme sqsize on off regression Jens Axboe

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=20221225103234.226794-3-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@fb.com \
    --cc=hughd@google.com \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=torvalds@linux-foundation.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