From: Keith Busch <kbusch@kernel.org>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
io-uring@vger.kernel.org, linux-block@vger.kernel.org,
linux-nvme@lists.infradead.org
Subject: Re: [PATCH] nvme: optimize passthrough IOPOLL completion for local ring context
Date: Thu, 15 Jan 2026 11:21:41 -0700 [thread overview]
Message-ID: <aWkwNVgAyBbx732l@kbusch-mbp> (raw)
In-Reply-To: <20260115085952.494077-1-ming.lei@redhat.com>
On Thu, Jan 15, 2026 at 04:59:52PM +0800, Ming Lei wrote:
> + if (blk_rq_is_poll(req) && req->poll_ctx == io_uring_cmd_ctx_handle(ioucmd)) {
...
> @@ -677,8 +691,14 @@ int nvme_ns_chr_uring_cmd_iopoll(struct io_uring_cmd *ioucmd,
> struct nvme_uring_cmd_pdu *pdu = nvme_uring_cmd_pdu(ioucmd);
> struct request *req = pdu->req;
>
> - if (req && blk_rq_is_poll(req))
> + if (req && blk_rq_is_poll(req)) {
> + /*
> + * Store the polling context in the request so end_io can
> + * detect if it's completing in the local ring's context.
> + */
> + req->poll_ctx = iob ? iob->poll_ctx : NULL;
I don't think this works. The io_uring polling always polls from a
single ctx's iopoll_list, so it's redundant to store the ctx in the iob
since it will always match the ctx of the ioucmd passed in.
Which then leads to the check at the top: if req->poll_ctx was ever set,
then it should always match its ioucmd ctx too, right? If it was set
once before, but the polling didn't find the completion, then another
ctx polling does find it, we won't complete it in the iouring task as
needed.
I think you want to save off ctx that called
'nvme_ns_chr_uring_cmd_iopoll()', but there doesn't seem to be an
immediate way to refer back to that from 'nvme_uring_cmd_end_io'. Maybe
stash it in current->io_uring->last instead, then check if
io_uring_cmd_ctx_handle(ioucmd)) equals that.
next prev parent reply other threads:[~2026-01-15 18:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-15 8:59 [PATCH] nvme: optimize passthrough IOPOLL completion for local ring context Ming Lei
2026-01-15 18:21 ` Keith Busch [this message]
2026-01-16 2:29 ` Ming Lei
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=aWkwNVgAyBbx732l@kbusch-mbp \
--to=kbusch@kernel.org \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=ming.lei@redhat.com \
/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