public inbox for [email protected]
 help / color / mirror / Atom feed
From: Kanchan Joshi <[email protected]>
To: Keith Busch <[email protected]>
Cc: [email protected], [email protected],
	[email protected], [email protected], [email protected],
	[email protected], Keith Busch <[email protected]>
Subject: Re: [PATCHv2 2/5] nvme: simplify passthrough bio cleanup
Date: Mon, 10 Apr 2023 16:55:03 +0530	[thread overview]
Message-ID: <20230410112503.GA16047@green5> (raw)
In-Reply-To: <[email protected]>

[-- Attachment #1: Type: text/plain, Size: 2028 bytes --]

On Fri, Apr 07, 2023 at 12:16:33PM -0700, Keith Busch wrote:
>From: Keith Busch <[email protected]>
>
>Set the bio's bi_end_io to handle the cleanup so that uring_cmd doesn't
>need this complex pdu->{bio,req} switchero and restore.
>
>Signed-off-by: Keith Busch <[email protected]>
>---
> drivers/nvme/host/ioctl.c | 26 +++++++++-----------------
> 1 file changed, 9 insertions(+), 17 deletions(-)
>
>diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
>index d24ea2e051564..278c57ee0db91 100644
>--- a/drivers/nvme/host/ioctl.c
>+++ b/drivers/nvme/host/ioctl.c
>@@ -159,6 +159,11 @@ static struct request *nvme_alloc_user_request(struct request_queue *q,
> 	return req;
> }
>
>+static void nvme_uring_bio_end_io(struct bio *bio)
>+{
>+	blk_rq_unmap_user(bio);
>+}
>+
> static int nvme_map_user_request(struct request *req, u64 ubuffer,
> 		unsigned bufflen, void __user *meta_buffer, unsigned meta_len,
> 		u32 meta_seed, void **metap, struct io_uring_cmd *ioucmd,
>@@ -204,6 +209,7 @@ static int nvme_map_user_request(struct request *req, u64 ubuffer,
> 		*metap = meta;
> 	}
>
>+	bio->bi_end_io = nvme_uring_bio_end_io;
> 	return ret;
>
> out_unmap:
>@@ -249,8 +255,6 @@ static int nvme_submit_user_cmd(struct request_queue *q,
> 	if (meta)
> 		ret = nvme_finish_user_metadata(req, meta_buffer, meta,
> 						meta_len, ret);
>-	if (bio)
>-		blk_rq_unmap_user(bio);

Is it safe to call blk_rq_unamp_user in irq context?
Agree that current code does some complex stuff, but that's to ensure
what the code-comment [1] says.

Also for polled-io, new-code will hit this warn-on [2] on calling
bio_put_percpu_cache.

[1] 
623  *    A matching blk_rq_unmap_user() must be issued at the end of I/O, while
624  *    still in process context.
625  */
626 int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
627                         struct rq_map_data *map_data,


[2]
773         if ((bio->bi_opf & REQ_POLLED) && !WARN_ON_ONCE(in_interrupt())) {
774                 bio->bi_next = cache->free_list;

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  parent reply	other threads:[~2023-04-10 11:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-07 19:16 [PATCHv2 0/5] nvme io_uring_cmd polling enhancements Keith Busch
2023-04-07 19:16 ` [PATCHv2 1/5] block: add request polling helper Keith Busch
2023-04-07 19:16 ` [PATCHv2 2/5] nvme: simplify passthrough bio cleanup Keith Busch
2023-04-08  0:22   ` kernel test robot
2023-04-10 11:25   ` Kanchan Joshi [this message]
2023-04-11 17:46     ` Keith Busch
2023-04-10 21:02   ` kernel test robot
2023-04-07 19:16 ` [PATCHv2 3/5] nvme: unify nvme request end_io Keith Busch
2023-04-10 11:34   ` Kanchan Joshi
2023-04-07 19:16 ` [PATCHv2 4/5] nvme: use blk-mq polling for uring commands Keith Busch
2023-04-07 19:16 ` [PATCHv2 5/5] io_uring: remove uring_cmd cookie Keith Busch

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=20230410112503.GA16047@green5 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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