From: Jens Axboe <axboe@kernel.dk>
To: Pavel Begunkov <asml.silence@gmail.com>, io-uring@vger.kernel.org
Subject: Re: [PATCH 1/1] io_uring: add lockdep checks for io_handle_tw_list
Date: Tue, 1 Apr 2025 10:13:27 -0600 [thread overview]
Message-ID: <65765d68-cda0-41fb-acdf-58e7b5c1243f@kernel.dk> (raw)
In-Reply-To: <ffd30102aee729e48911f595d1c05804e59b0403.1743522348.git.asml.silence@gmail.com>
On 4/1/25 9:46 AM, Pavel Begunkov wrote:
> Add a lockdep check to io_handle_tw_list() verifying that the context is
> locked and no task work drops it by accident.
I think we'd want a bit more of a "why" explanation here, but I can add
that while committing.
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
> index 6df996d01ccf..13e0b48d1aac 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -1054,6 +1054,10 @@ struct llist_node *io_handle_tw_list(struct llist_node *node,
> mutex_lock(&ctx->uring_lock);
> percpu_ref_get(&ctx->refs);
> }
> +
> + lockdep_assert(req->ctx == ctx);
> + lockdep_assert_held(&ctx->uring_lock);
> +
> INDIRECT_CALL_2(req->io_task_work.func,
> io_poll_task_func, io_req_rw_complete,
> req, ts);
If the assumption is that some previous tw messed things up, might not
be a bad idea to include dumping of that if one of the above lockdep
asserts fail? Preferably in such a way that code generation is the same
when lockdep isn't set...
--
Jens Axboe
next prev parent reply other threads:[~2025-04-01 16:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-01 15:46 [PATCH 1/1] io_uring: add lockdep checks for io_handle_tw_list Pavel Begunkov
2025-04-01 16:13 ` Jens Axboe [this message]
2025-04-01 17:19 ` Pavel Begunkov
2025-04-01 18:14 ` 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=65765d68-cda0-41fb-acdf-58e7b5c1243f@kernel.dk \
--to=axboe@kernel.dk \
--cc=asml.silence@gmail.com \
--cc=io-uring@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.