From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: kbusch@kernel.org, axboe@fb.com, hch@lst.de, sagi@grimberg.me
Cc: baolin.wang@linux.alibaba.com, baolin.wang7@gmail.com,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] nvme: Add Arbitration Burst support
Date: Tue, 23 Jun 2020 21:24:32 +0800 [thread overview]
Message-ID: <bf3f47ba50f72d0b775ca4bd098f183056d964ba.1592916850.git.baolin.wang@linux.alibaba.com> (raw)
In-Reply-To: <cover.1592916850.git.baolin.wang@linux.alibaba.com>
In-Reply-To: <cover.1592916850.git.baolin.wang@linux.alibaba.com>
From the NVMe spec, "In order to make efficient use of the non-volatile
memory, it is often advantageous to execute multiple commands from a
Submission Queue in parallel. For Submission Queues that are using
weighted round robin with urgent priority class or round robin
arbitration, host software may configure an Arbitration Burst setting".
Thus add Arbitration Burst setting support.
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
drivers/nvme/host/core.c | 23 +++++++++++++++++++++++
drivers/nvme/host/nvme.h | 2 ++
drivers/nvme/host/pci.c | 2 ++
3 files changed, 27 insertions(+)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index c2c5bc4..c3a60d8 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1241,6 +1241,28 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count)
}
EXPORT_SYMBOL_GPL(nvme_set_queue_count);
+void nvme_set_arbitration_burst(struct nvme_ctrl *ctrl)
+{
+ u32 result;
+ int status;
+
+ if (!ctrl->rab)
+ return;
+
+ /*
+ * The Arbitration Burst setting indicates the maximum number of
+ * commands that the controller may launch at one time from a
+ * particular Submission Queue. It is recommended that host software
+ * configure the Arbitration Burst setting as close to the recommended
+ * value by the controller as possible.
+ */
+ status = nvme_set_features(ctrl, NVME_FEAT_ARBITRATION, ctrl->rab,
+ NULL, 0, &result);
+ if (status)
+ dev_warn(ctrl->device, "Failed to set Arbitration Burst\n");
+}
+EXPORT_SYMBOL_GPL(nvme_set_arbitration_burst);
+
#define NVME_AEN_SUPPORTED \
(NVME_AEN_CFG_NS_ATTR | NVME_AEN_CFG_FW_ACT | \
NVME_AEN_CFG_ANA_CHANGE | NVME_AEN_CFG_DISC_CHANGE)
@@ -2953,6 +2975,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
} else
ctrl->shutdown_timeout = shutdown_timeout;
+ ctrl->rab = id->rab;
ctrl->npss = id->npss;
ctrl->apsta = id->apsta;
prev_apst_enabled = ctrl->apst_enabled;
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index c0f4226..3934426 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -246,6 +246,7 @@ struct nvme_ctrl {
u16 kas;
u8 npss;
u8 apsta;
+ u8 rab;
u16 wctemp;
u16 cctemp;
u32 oaes;
@@ -550,6 +551,7 @@ int nvme_get_features(struct nvme_ctrl *dev, unsigned int fid,
unsigned int dword11, void *buffer, size_t buflen,
u32 *result);
int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count);
+void nvme_set_arbitration_burst(struct nvme_ctrl *ctrl);
void nvme_stop_keep_alive(struct nvme_ctrl *ctrl);
int nvme_reset_ctrl(struct nvme_ctrl *ctrl);
int nvme_reset_ctrl_sync(struct nvme_ctrl *ctrl);
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index e2bacd3..4b4b7b7 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2111,6 +2111,8 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
clear_bit(NVMEQ_ENABLED, &adminq->flags);
+ nvme_set_arbitration_burst(&dev->ctrl);
+
if (dev->cmb_use_sqes) {
result = nvme_cmb_qdepth(dev, nr_io_queues,
sizeof(struct nvme_command));
--
1.8.3.1
next prev parent reply other threads:[~2020-06-23 13:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-23 13:24 [PATCH 0/3] Some improvements for NVMe Baolin Wang
2020-06-23 13:24 ` Baolin Wang [this message]
2020-06-23 14:40 ` [PATCH 1/3] nvme: Add Arbitration Burst support Keith Busch
2020-06-23 17:39 ` Sagi Grimberg
2020-06-23 18:01 ` Keith Busch
2020-06-24 1:34 ` Baolin Wang
2020-06-24 2:51 ` Keith Busch
2020-06-24 2:54 ` Baolin Wang
2020-06-24 2:57 ` Keith Busch
2020-06-24 3:06 ` Baolin Wang
2020-06-23 13:24 ` [PATCH 2/3] nvme-pci: Add controller memory buffer supported macro Baolin Wang
2020-06-23 16:27 ` Christoph Hellwig
2020-06-24 2:07 ` Baolin Wang
2020-06-24 6:22 ` Baolin Wang
2020-06-24 2:58 ` Keith Busch
2020-06-24 5:47 ` Christoph Hellwig
2020-06-23 13:24 ` [PATCH 3/3] nvme: Use USEC_PER_SEC instead of magic numbers Baolin Wang
2020-06-23 17:39 ` 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=bf3f47ba50f72d0b775ca4bd098f183056d964ba.1592916850.git.baolin.wang@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=axboe@fb.com \
--cc=baolin.wang7@gmail.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®