public inbox for [email protected]
 help / color / mirror / Atom feed
From: Kanchan Joshi <[email protected]>
To: Jens Axboe <[email protected]>
Cc: io-uring <[email protected]>,
	"[email protected]" <[email protected]>,
	Ming Lei <[email protected]>
Subject: Re: [PATCH] block/io_uring: pass in issue_flags for uring_cmd task_work handling
Date: Tue, 21 Mar 2023 19:08:17 +0530	[thread overview]
Message-ID: <CA+1E3rK4kN8gZEzqBThaZRrD_G7JJPeVK8BA57S5OezjC5Jz2w@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>

On Tue, Mar 21, 2023 at 7:37 AM Jens Axboe <[email protected]> wrote:
>
> io_uring_cmd_done() currently assumes that the uring_lock is held
> when invoked, and while it generally is, this is not guaranteed.
> Pass in the issue_flags associated with it, so that we have
> IO_URING_F_UNLOCKED available to be able to lock the CQ ring
> appropriately when completing events.
>
> Cc: [email protected]
> Fixes: ee692a21e9bf ("fs,io_uring: add infrastructure for uring-cmd")

While the ability to pass flags seems useful, I am trying to
understand if the tag 'fixes' is a must?
Before this patch, the F_UNLOCKED flag was not used and completions go
to line 1006 (please see below).
After this patch also, completions execute the same code as IOPOLL is not set.
In both cases, ctx->completion_lock is being acquired while posting completions.
And for polled passthrough IOs, we don't execute this code anway.

999 void io_req_complete_post(struct io_kiocb *req, unsigned issue_flags)
1000 {
1001         if (req->ctx->task_complete && (issue_flags & IO_URING_F_IOWQ)) {
1002                 req->io_task_work.func = io_req_task_complete;
1003                 io_req_task_work_add(req);
1004         } else if (!(issue_flags & IO_URING_F_UNLOCKED) ||
1005                    !(req->ctx->flags & IORING_SETUP_IOPOLL)) {
1006                 __io_req_complete_post(req);
1007         } else {
1008                 struct io_ring_ctx *ctx = req->ctx;
1009
1010                 mutex_lock(&ctx->uring_lock);
1011                 __io_req_complete_post(req);

      reply	other threads:[~2023-03-21 13:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21  2:06 [PATCH] block/io_uring: pass in issue_flags for uring_cmd task_work handling Jens Axboe
2023-03-21 13:38 ` Kanchan Joshi [this message]

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=CA+1E3rK4kN8gZEzqBThaZRrD_G7JJPeVK8BA57S5OezjC5Jz2w@mail.gmail.com \
    [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