linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Bui Quang Minh <minhquangbui99@gmail.com>, linux-kernel@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>,
	io-uring@vger.kernel.org,
	syzbot+3c750be01dab672c513d@syzkaller.appspotmail.com,
	Li Zetao <lizetao1@huawei.com>
Subject: Re: [PATCH v2] io_uring: simplify the SQPOLL thread check when cancelling requests
Date: Mon, 13 Jan 2025 21:34:56 +0000	[thread overview]
Message-ID: <a5910007-017c-4b80-b0ae-e36569c88b15@gmail.com> (raw)
In-Reply-To: <20250113160331.44057-1-minhquangbui99@gmail.com>

On 1/13/25 16:03, Bui Quang Minh wrote:
> In io_uring_try_cancel_requests, we check whether sq_data->thread ==
> current to determine if the function is called by the SQPOLL thread to do
> iopoll when IORING_SETUP_SQPOLL is set. This check can race with the SQPOLL
> thread termination.
> 
> io_uring_cancel_generic is used in 2 places: io_uring_cancel_generic and
> io_ring_exit_work. In io_uring_cancel_generic, we have the information
> whether the current is SQPOLL thread already. And the SQPOLL thread never
> reaches io_ring_exit_work.
> 
> So to avoid the racy check, this commit adds a boolean flag to
> io_uring_try_cancel_requests to determine if the caller is SQPOLL thread.

I think the comment is excessive, but let's leave it at that if
you don't want to respin it.

Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>

-- 
Pavel Begunkov


  reply	other threads:[~2025-01-13 21:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13 16:03 [PATCH v2] io_uring: simplify the SQPOLL thread check when cancelling requests Bui Quang Minh
2025-01-13 21:34 ` Pavel Begunkov [this message]
2025-01-13 22:30 ` 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=a5910007-017c-4b80-b0ae-e36569c88b15@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizetao1@huawei.com \
    --cc=minhquangbui99@gmail.com \
    --cc=syzbot+3c750be01dab672c513d@syzkaller.appspotmail.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;
as well as URLs for NNTP newsgroup(s).