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 1/4] nvme: fix setting the queue depth in nvme_alloc_io_tag_set
Date: Sun, 25 Dec 2022 11:32:31 +0100 [thread overview]
Message-ID: <20221225103234.226794-2-hch@lst.de> (raw)
In-Reply-To: <20221225103234.226794-1-hch@lst.de>
While the CAP.MQES field in NVMe is a 0s based filed with a natural one
off, we also need to account for the queue wrap condition and fix undo
the one off again in nvme_alloc_io_tag_set. This was never properly
done by the fabrics drivers, but they don't seem to care because there
is no actual physical queue that can wrap around, but it became a
problem when converting over the PCIe driver. Also add back the
BLK_MQ_MAX_DEPTH check that was lost in the same commit.
Fixes: 0da7feaa5913 ("nvme-pci: use the tagset alloc/free helpers")
Reported-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/nvme/host/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index e26b085a007aea..cda1361e6d4fbb 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -4897,7 +4897,7 @@ int nvme_alloc_io_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
memset(set, 0, sizeof(*set));
set->ops = ops;
- set->queue_depth = ctrl->sqsize + 1;
+ set->queue_depth = min_t(unsigned, ctrl->sqsize, BLK_MQ_MAX_DEPTH - 1);
/*
* Some Apple controllers requires tags to be unique across admin and
* the (only) I/O queue, so reserve the first 32 tags of the I/O queue.
--
2.35.1
next prev 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 ` Christoph Hellwig [this message]
2022-12-25 10:51 ` [PATCH 1/4] nvme: fix setting the queue depth in nvme_alloc_io_tag_set 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 ` [PATCH 2/4] nvme-pci: update sqsize when adjusting the queue depth Christoph Hellwig
2022-12-25 11:19 ` 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-2-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