All of lore.kernel.org
 help / color / mirror / Atom feed
From: sagi@grimberg.me (Sagi Grimberg)
Subject: [PATCH 5/7] nvme-rdma: don't override opts->queue_size
Date: Tue, 19 Jun 2018 15:34:13 +0300	[thread overview]
Message-ID: <20180619123415.25077-6-sagi@grimberg.me> (raw)
In-Reply-To: <20180619123415.25077-1-sagi@grimberg.me>

That is user argument, and theoretically controller limits can
change over time (over reconnects/resets). Instead, use sqsize
controller attribute to check queue depth boundaries and use it
to the tagset allocation.

Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
 drivers/nvme/host/rdma.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index edf63cd106ff..9dc1c37b5f65 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -692,7 +692,7 @@ static struct blk_mq_tag_set *nvme_rdma_alloc_tagset(struct nvme_ctrl *nctrl,
 		set = &ctrl->tag_set;
 		memset(set, 0, sizeof(*set));
 		set->ops = &nvme_rdma_mq_ops;
-		set->queue_depth = nctrl->opts->queue_size;
+		set->queue_depth = nctrl->sqsize + 1;
 		set->reserved_tags = 1; /* fabric connect */
 		set->numa_node = NUMA_NO_NODE;
 		set->flags = BLK_MQ_F_SHOULD_MERGE;
@@ -1977,20 +1977,22 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev,
 		goto out_remove_admin_queue;
 	}
 
-	if (opts->queue_size > ctrl->ctrl.maxcmd) {
-		/* warn if maxcmd is lower than queue_size */
-		dev_warn(ctrl->ctrl.device,
-			"queue_size %zu > ctrl maxcmd %u, clamping down\n",
-			opts->queue_size, ctrl->ctrl.maxcmd);
-		opts->queue_size = ctrl->ctrl.maxcmd;
-	}
-
 	if (opts->queue_size > ctrl->ctrl.sqsize + 1) {
-		/* warn if sqsize is lower than queue_size */
+		/*
+		 * warn if sqsize is lower than queue_size actual calmping
+		 * will be by using sqsize for the tagset allocation later.
+		 */
 		dev_warn(ctrl->ctrl.device,
 			"queue_size %zu > ctrl sqsize %u, clamping down\n",
 			opts->queue_size, ctrl->ctrl.sqsize + 1);
-		opts->queue_size = ctrl->ctrl.sqsize + 1;
+	}
+
+	if (ctrl->ctrl.sqsize + 1 > ctrl->ctrl.maxcmd) {
+		/* warn if maxcmd is lower than sqsize+1 */
+		dev_warn(ctrl->ctrl.device,
+			"sqsize %u > ctrl maxcmd %u, clamping down\n",
+			ctrl->ctrl.sqsize + 1, ctrl->ctrl.maxcmd);
+		ctrl->ctrl.sqsize = ctrl->ctrl.maxcmd - 1;
 	}
 
 	if (opts->nr_io_queues) {
-- 
2.14.1

  parent reply	other threads:[~2018-06-19 12:34 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-19 12:34 [PATCH 0/7] few nvme-rdma fixes for 4.18 Sagi Grimberg
2018-06-19 12:34 ` [PATCH 1/7] nvme-rdma: fix possible double free condition when failing to create a controller Sagi Grimberg
2018-06-20  9:06   ` Max Gurtovoy
2018-06-20 10:41     ` Sagi Grimberg
2018-06-20 12:29       ` Christoph Hellwig
2018-06-19 12:34 ` [PATCH 2/7] nvme-rdma: fix possible free non-allocated async event buffer Sagi Grimberg
2018-06-20  8:31   ` Christoph Hellwig
2018-06-20 12:02     ` Max Gurtovoy
2018-06-24 10:40       ` [Suspected-Phishing]Re: " Max Gurtovoy
2018-06-24 16:00         ` Sagi Grimberg
2018-06-24 16:19           ` Max Gurtovoy
2018-06-19 12:34 ` [PATCH 3/7] nvme-rdma: Fix command completion race at error recovery Sagi Grimberg
2018-06-19 12:34 ` [PATCH 4/7] nvme-rdma: unquiesce queues when deleting the controller Sagi Grimberg
2018-06-21  9:57   ` Max Gurtovoy
2018-06-24 16:07     ` Sagi Grimberg
2018-06-19 12:34 ` Sagi Grimberg [this message]
2018-06-19 16:56   ` [PATCH 5/7] nvme-rdma: don't override opts->queue_size Daniel Verkamp
2018-06-19 12:34 ` [PATCH 6/7] nvme-rdma: centralize controller setup sequence Sagi Grimberg
2018-06-19 12:34 ` [PATCH 7/7] nvme-rdma: centralize admin/io queue teardown sequence Sagi Grimberg
2018-06-20  8:40 ` [PATCH 0/7] few nvme-rdma fixes for 4.18 Christoph Hellwig
2018-06-20  8:40   ` Sagi Grimberg
2018-06-20  8:52     ` Christoph Hellwig
2018-06-20  8:53       ` Sagi Grimberg
2018-06-20  9:05         ` Christoph Hellwig
2018-06-20  9:08           ` Sagi Grimberg

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=20180619123415.25077-6-sagi@grimberg.me \
    --to=sagi@grimberg.me \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.