From: Gabriel Krisman Bertazi <krisman@suse.de>
To: Sidong Yang <sidong.yang@furiosa.ai>, io-uring@vger.kernel.org
Cc: Sidong Yang <sidong.yang@furiosa.ai>,
Pavel Begunkov <asml.silence@gmail.com>,
Jens Axboe <axboe@kernel.dk>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] io_uring/bpf-ops: wake up the loop task on eject
Date: Fri, 14 Aug 2026 12:50:52 -0400 [thread overview]
Message-ID: <87se4g4peb.fsf@mailhost.krisman.be> (raw)
In-Reply-To: <20260814030421.61216-1-sidong.yang@furiosa.ai>
Sidong Yang <sidong.yang@furiosa.ai> writes:
> io_eject_bpf() clears ctx->loop_step while a loop may be sleeping in
> io_loop_wait(), which releases ->uring_lock before schedule(). Nothing
> wakes the submitter task after the BPF ops are unregistered through link
> destruction or ring teardown, so the task stays blocked in
> io_uring_enter() until an unrelated CQE event or signal arrives.
>
> Since BPF ops require IORING_SETUP_DEFER_TASKRUN, only
> ctx->submitter_task can run the loop, so wake it directly. The loop
> rechecks loop_step after waking up and exits with -EFAULT. A spurious
> wakeup is harmless because io_loop_wait() rechecks the wait condition
> before sleeping again.
>
> Fixes: 98f37634b12b ("io_uring/bpf-ops: implement bpf ops registration")
> Signed-off-by: Sidong Yang <sidong.yang@furiosa.ai>
Makes sense, feel free to add:
Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
> ---
> io_uring/bpf-ops.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/io_uring/bpf-ops.c b/io_uring/bpf-ops.c
> index 5a50f0675fe5..87148dbd3b3e 100644
> --- a/io_uring/bpf-ops.c
> +++ b/io_uring/bpf-ops.c
> @@ -210,6 +210,13 @@ static void io_eject_bpf(struct io_ring_ctx *ctx)
> ops->priv = NULL;
> ctx->bpf_ops = NULL;
> ctx->loop_step = NULL;
> + /*
> + * A loop may be sleeping in io_loop_wait() with ->uring_lock
> + * released. It'll see loop_step == NULL after waking up, but
> + * nothing wakes it otherwise.
> + */
> + if (ctx->submitter_task)
> + wake_up_state(ctx->submitter_task, TASK_INTERRUPTIBLE);
> }
>
> static void bpf_io_unreg(void *kdata, struct bpf_link *link)
> --
> 2.53.0
>
--
Gabriel Krisman Bertazi
next prev parent reply other threads:[~2026-08-14 16:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 3:04 Sidong Yang
2026-08-14 16:50 ` Gabriel Krisman Bertazi [this message]
2026-08-15 10:26 ` Pavel Begunkov
2026-08-15 11:10 ` Sidong Yang
2026-08-16 13:26 ` Pavel Begunkov
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=87se4g4peb.fsf@mailhost.krisman.be \
--to=krisman@suse.de \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sidong.yang@furiosa.ai \
/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
all inboxes | Powered by JetHome®