From: Jens Axboe <axboe@kernel.dk>
To: linux-block@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 01/11] nvme: provide optimized poll function for separate poll queues
Date: Thu, 15 Nov 2018 12:51:25 -0700 [thread overview]
Message-ID: <20181115195135.22812-2-axboe@kernel.dk> (raw)
In-Reply-To: <20181115195135.22812-1-axboe@kernel.dk>
If we have separate poll queues, we know that they aren't using
interrupts. Hence we don't need to disable interrupts around
finding completions.
Provide a separate set of blk_mq_ops for such devices.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
drivers/nvme/host/pci.c | 45 +++++++++++++++++++++++++++++++++--------
1 file changed, 37 insertions(+), 8 deletions(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index ffbab5b01df4..fc7dd49f22fc 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1082,6 +1082,23 @@ static int nvme_poll(struct blk_mq_hw_ctx *hctx, unsigned int tag)
return __nvme_poll(nvmeq, tag);
}
+static int nvme_poll_noirq(struct blk_mq_hw_ctx *hctx, unsigned int tag)
+{
+ struct nvme_queue *nvmeq = hctx->driver_data;
+ u16 start, end;
+ bool found;
+
+ if (!nvme_cqe_pending(nvmeq))
+ return 0;
+
+ spin_lock(&nvmeq->cq_lock);
+ found = nvme_process_cq(nvmeq, &start, &end, tag);
+ spin_unlock(&nvmeq->cq_lock);
+
+ nvme_complete_cqes(nvmeq, start, end);
+ return found;
+}
+
static void nvme_pci_submit_async_event(struct nvme_ctrl *ctrl)
{
struct nvme_dev *dev = to_nvme_dev(ctrl);
@@ -1584,17 +1601,25 @@ static const struct blk_mq_ops nvme_mq_admin_ops = {
.timeout = nvme_timeout,
};
+#define NVME_SHARED_MQ_OPS \
+ .queue_rq = nvme_queue_rq, \
+ .rq_flags_to_type = nvme_rq_flags_to_type, \
+ .complete = nvme_pci_complete_rq, \
+ .init_hctx = nvme_init_hctx, \
+ .init_request = nvme_init_request, \
+ .map_queues = nvme_pci_map_queues, \
+ .timeout = nvme_timeout \
+
static const struct blk_mq_ops nvme_mq_ops = {
- .queue_rq = nvme_queue_rq,
- .rq_flags_to_type = nvme_rq_flags_to_type,
- .complete = nvme_pci_complete_rq,
- .init_hctx = nvme_init_hctx,
- .init_request = nvme_init_request,
- .map_queues = nvme_pci_map_queues,
- .timeout = nvme_timeout,
+ NVME_SHARED_MQ_OPS,
.poll = nvme_poll,
};
+static const struct blk_mq_ops nvme_mq_poll_noirq_ops = {
+ NVME_SHARED_MQ_OPS,
+ .poll = nvme_poll_noirq,
+};
+
static void nvme_dev_remove_admin(struct nvme_dev *dev)
{
if (dev->ctrl.admin_q && !blk_queue_dying(dev->ctrl.admin_q)) {
@@ -2274,7 +2299,11 @@ static int nvme_dev_add(struct nvme_dev *dev)
int ret;
if (!dev->ctrl.tagset) {
- dev->tagset.ops = &nvme_mq_ops;
+ if (!dev->io_queues[NVMEQ_TYPE_POLL])
+ dev->tagset.ops = &nvme_mq_ops;
+ else
+ dev->tagset.ops = &nvme_mq_poll_noirq_ops;
+
dev->tagset.nr_hw_queues = dev->online_queues - 1;
dev->tagset.nr_maps = NVMEQ_TYPE_NR;
dev->tagset.timeout = NVME_IO_TIMEOUT;
--
2.17.1
next prev parent reply other threads:[~2018-11-15 19:51 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-15 19:51 [PATCHSET v2 0/11] Various block optimizations Jens Axboe
2018-11-15 19:51 ` Jens Axboe [this message]
2018-11-16 8:35 ` [PATCH 01/11] nvme: provide optimized poll function for separate poll queues Christoph Hellwig
2018-11-16 15:22 ` Jens Axboe
2018-11-15 19:51 ` [PATCH 02/11] block: add queue_is_mq() helper Jens Axboe
2018-11-16 8:35 ` Christoph Hellwig
2018-11-15 19:51 ` [PATCH 03/11] blk-rq-qos: inline check for q->rq_qos functions Jens Axboe
2018-11-16 8:38 ` Christoph Hellwig
2018-11-16 15:18 ` Jens Axboe
2018-11-15 19:51 ` [PATCH 04/11] block: avoid ordered task state change for polled IO Jens Axboe
2018-11-16 8:41 ` Christoph Hellwig
2018-11-16 15:32 ` Jens Axboe
2018-11-15 19:51 ` [PATCH 05/11] block: add polled wakeup task helper Jens Axboe
2018-11-16 8:41 ` Christoph Hellwig
2018-11-15 19:51 ` [PATCH 06/11] block: have ->poll_fn() return number of entries polled Jens Axboe
2018-11-15 19:51 ` [PATCH 07/11] blk-mq: when polling for IO, look for any completion Jens Axboe
2018-11-16 8:43 ` Christoph Hellwig
2018-11-16 15:19 ` Jens Axboe
2018-11-16 16:57 ` Jens Axboe
2018-11-15 19:51 ` [PATCH 08/11] block: make blk_poll() take a parameter on whether to spin or not Jens Axboe
2018-11-15 19:51 ` [PATCH 09/11] blk-mq: ensure mq_ops ->poll() is entered at least once Jens Axboe
2018-11-15 19:51 ` [PATCH 10/11] block: for async O_DIRECT, mark us as polling if asked to Jens Axboe
2018-11-16 8:47 ` Christoph Hellwig
2018-11-16 8:48 ` Christoph Hellwig
2018-11-16 15:19 ` Jens Axboe
2018-11-15 19:51 ` [PATCH 11/11] block: don't plug for aio/O_DIRECT HIPRI IO Jens Axboe
2018-11-16 8:49 ` 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=20181115195135.22812-2-axboe@kernel.dk \
--to=axboe@kernel.dk \
--cc=linux-block@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).