linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
Subject: Re: [PATCH 9/9] nvme: wire up completion batching for the IRQ path
Date: Thu, 14 Oct 2021 08:53:39 +0100	[thread overview]
Message-ID: <YWfiA96OpkT4Oomp@infradead.org> (raw)
In-Reply-To: <20211013165416.985696-10-axboe@kernel.dk>

Couldn't we do something like the incremental patch below to avoid
duplicating the CQ processing? With that this patch could probably go
away entirely and we could fold the change into the other nvme patch.

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 061f0b1cb0ec3..ce69e9666caac 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1059,9 +1059,8 @@ static inline void nvme_update_cq_head(struct nvme_queue *nvmeq)
 	}
 }
 
-static inline int nvme_process_cq(struct nvme_queue *nvmeq)
+static inline int nvme_poll_cq(struct nvme_queue *nvmeq, struct io_batch *iob)
 {
-	DEFINE_IO_BATCH(iob);
 	int found = 0;
 
 	while (nvme_cqe_pending(nvmeq)) {
@@ -1071,15 +1070,23 @@ static inline int nvme_process_cq(struct nvme_queue *nvmeq)
 		 * the cqe requires a full read memory barrier
 		 */
 		dma_rmb();
-		nvme_handle_cqe(nvmeq, &iob, nvmeq->cq_head);
+		nvme_handle_cqe(nvmeq, iob, nvmeq->cq_head);
 		nvme_update_cq_head(nvmeq);
 	}
 
-	if (found) {
-		if (iob.req_list)
-			nvme_pci_complete_batch(&iob);
+	if (found)
 		nvme_ring_cq_doorbell(nvmeq);
-	}
+	return found;
+}
+
+static inline int nvme_process_cq(struct nvme_queue *nvmeq)
+{
+	DEFINE_IO_BATCH(iob);
+	int found;
+
+	found = nvme_poll_cq(nvmeq, &iob);
+	if (iob.req_list)
+		nvme_pci_complete_batch(&iob);
 	return found;
 }
 
@@ -1116,27 +1123,6 @@ static void nvme_poll_irqdisable(struct nvme_queue *nvmeq)
 	enable_irq(pci_irq_vector(pdev, nvmeq->cq_vector));
 }
 
-static inline int nvme_poll_cq(struct nvme_queue *nvmeq, struct io_batch *iob)
-{
-	int found = 0;
-
-	while (nvme_cqe_pending(nvmeq)) {
-		found++;
-		/*
-		 * load-load control dependency between phase and the rest of
-		 * the cqe requires a full read memory barrier
-		 */
-		dma_rmb();
-		nvme_handle_cqe(nvmeq, iob, nvmeq->cq_head);
-		nvme_update_cq_head(nvmeq);
-	}
-
-	if (found)
-		nvme_ring_cq_doorbell(nvmeq);
-	return found;
-}
-
-
 static int nvme_poll(struct blk_mq_hw_ctx *hctx, struct io_batch *iob)
 {
 	struct nvme_queue *nvmeq = hctx->driver_data;

  reply	other threads:[~2021-10-14  7:55 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13 16:54 [PATCHSET v2 0/9] Batched completions Jens Axboe
2021-10-13 16:54 ` [PATCH 1/9] block: define io_batch structure Jens Axboe
2021-10-14  5:45   ` Christoph Hellwig
2021-10-14 15:50     ` Jens Axboe
2021-10-14 16:06       ` Christoph Hellwig
2021-10-14 18:14         ` Jens Axboe
2021-10-13 16:54 ` [PATCH 2/9] block: add a struct io_batch argument to fops->iopoll() Jens Axboe
2021-10-13 16:54 ` [PATCH 3/9] sbitmap: add helper to clear a batch of tags Jens Axboe
2021-10-13 16:54 ` [PATCH 4/9] sbitmap: test bit before calling test_and_set_bit() Jens Axboe
2021-10-14  7:20   ` Hannes Reinecke
2021-10-14 13:01     ` Jens Axboe
2021-10-14 18:41   ` Bart Van Assche
2021-10-13 16:54 ` [PATCH 5/9] block: add support for blk_mq_end_request_batch() Jens Axboe
2021-10-14  7:32   ` Christoph Hellwig
2021-10-14 15:27     ` Jens Axboe
2021-10-13 16:54 ` [PATCH 6/9] nvme: add support for batched completion of polled IO Jens Axboe
2021-10-14  7:43   ` Christoph Hellwig
2021-10-14 15:30     ` Jens Axboe
2021-10-14 15:34       ` Jens Axboe
2021-10-14 16:07       ` Christoph Hellwig
2021-10-14 16:11         ` Jens Axboe
2021-10-13 16:54 ` [PATCH 7/9] block: assign batch completion handler in blk_poll() Jens Axboe
2021-10-14  7:48   ` Christoph Hellwig
2021-10-14 15:43     ` Jens Axboe
2021-10-13 16:54 ` [PATCH 8/9] io_uring: utilize the io_batch infrastructure for more efficient polled IO Jens Axboe
2021-10-14  8:03   ` Christoph Hellwig
2021-10-14 15:45     ` Jens Axboe
2021-10-14 16:08       ` Christoph Hellwig
2021-10-14 18:14         ` Jens Axboe
2021-10-16  4:29           ` Christoph Hellwig
2021-10-16 14:33             ` Jens Axboe
2021-10-13 16:54 ` [PATCH 9/9] nvme: wire up completion batching for the IRQ path Jens Axboe
2021-10-14  7:53   ` Christoph Hellwig [this message]
2021-10-14 15:49     ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2021-10-12 18:17 [PATCHSET 0/9] Batched completions Jens Axboe
2021-10-12 18:17 ` [PATCH 9/9] nvme: wire up completion batching for the IRQ path Jens Axboe
2021-10-13  7:12   ` Christoph Hellwig
2021-10-13 15:04     ` 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=YWfiA96OpkT4Oomp@infradead.org \
    --to=hch@infradead.org \
    --cc=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).