diff mbox series

[PATCHv2] blk-mq: directly poll requests

Message ID 20230331180056.1155862-1-kbusch@meta.com (mailing list archive)
State New, archived
Headers show
Series [PATCHv2] blk-mq: directly poll requests | expand

Commit Message

Keith Busch March 31, 2023, 6 p.m. UTC
From: Keith Busch <kbusch@kernel.org>

Polling needs a bio with a valid bi_bdev, but neither of those are
guaranteed for polled driver requests. Make request based polling
directly use blk-mq's polling function instead.

When executing a request from a polled hctx, we know the request's
cookie, and that it's from a live blk-mq queue that supports polling, so
we can safely skip everything that bio_poll provides.

Cc: stable@kernel.org
Reported-by: Martin Belanger <Martin.Belanger@dell.com>
Reported-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Tested-by: Daniel Wagner <dwagner@suse.de>
Revieded-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
v1->v2:

  Split from the unnecessary nvme fabrics polling cleanup patches since
  there's no dependency with them, and will be posted separately.

  Added received reviews, tests, and cc stable

 block/blk-mq.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Jens Axboe April 4, 2023, 10:11 p.m. UTC | #1
On Fri, 31 Mar 2023 11:00:56 -0700, Keith Busch wrote:
> Polling needs a bio with a valid bi_bdev, but neither of those are
> guaranteed for polled driver requests. Make request based polling
> directly use blk-mq's polling function instead.
> 
> When executing a request from a polled hctx, we know the request's
> cookie, and that it's from a live blk-mq queue that supports polling, so
> we can safely skip everything that bio_poll provides.
> 
> [...]

Applied, thanks!

[1/1] blk-mq: directly poll requests
      commit: 38a8c4d1d45006841f0643f4cb29b5e50758837c

Best regards,
diff mbox series

Patch

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 1b304f66f4e8e..3b75de43293c3 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1326,8 +1326,6 @@  bool blk_rq_is_poll(struct request *rq)
 		return false;
 	if (rq->mq_hctx->type != HCTX_TYPE_POLL)
 		return false;
-	if (WARN_ON_ONCE(!rq->bio))
-		return false;
 	return true;
 }
 EXPORT_SYMBOL_GPL(blk_rq_is_poll);
@@ -1335,7 +1333,7 @@  EXPORT_SYMBOL_GPL(blk_rq_is_poll);
 static void blk_rq_poll_completion(struct request *rq, struct completion *wait)
 {
 	do {
-		bio_poll(rq->bio, NULL, 0);
+		blk_mq_poll(rq->q, blk_rq_to_qc(rq), NULL, 0);
 		cond_resched();
 	} while (!completion_done(wait));
 }