From: luyun <luyun_611@163.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
eddyz87@gmail.com, memxor@gmail.com, martin.lau@linux.dev,
song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org,
emil@etsalapatis.com, ihor.solodrai@linux.dev
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 1/2] bpf: Fix task work round ownership during cancellation
Date: Mon, 21 Sep 2026 18:22:59 +0800 [thread overview]
Message-ID: <c29d5338-ad68-4e0a-8cf6-4ae099fb633c@163.com> (raw)
In-Reply-To: <DLIMVC4MY6XT.22U1NMBVLDVM@gmail.com>
在 2026/9/19 01:54, Alexei Starovoitov 写道:
> On Fri Sep 18, 2026 at 8:00 AM UTC, Yun Lu wrote:
>> struct bpf_task_work_ctx {
>> enum bpf_task_work_state state;
>> refcount_t refcnt;
>> + /*
>> + * References to task/prog/work in the current scheduling round. The
>> + * STANDBY -> PENDING transition serializes initialization from zero.
>> + */
>> + refcount_t round_refs;
>> struct callback_head work;
>> struct irq_work irq_work;
>> + struct irq_work cancel_irq_work;
>> + struct irq_work destroy_irq_work;
> This is overkill. Find a different way to fix it.
Hi, Alexei
Thanks for reviewing, this has been dropped in v2.
Instead of the extra refcount and irq_work objects, v2 adds a
completion edge: the callback claims RUNNING and waits for the
scheduling irq_work invocation with irq_work_sync() before it resets
task/prog or publishes STANDBY. One temporary reference from the
existing ctx refcount covers the window where the callback bails out
on FREED before the handler's cancellation attempt, and a BUSY check
in acquire covers the add-failure path. No fields or states are added
to the context, and the cancel/destroy paths are unchanged.
v2: https://lore.kernel.org/all/20260921101453.69273-2-luyun_611@163.com/
---
Thanks,
Yun Lu
>
> pw-bot: cr
next prev parent reply other threads:[~2026-09-21 10:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 8:00 [PATCH bpf-next 0/2] bpf: Fix task work round ownership race Yun Lu
2026-09-18 8:00 ` [PATCH bpf-next 1/2] bpf: Fix task work round ownership during cancellation Yun Lu
2026-09-18 17:54 ` Alexei Starovoitov
2026-09-21 10:22 ` luyun [this message]
2026-09-18 8:00 ` [PATCH bpf-next 2/2] selftests/bpf: Add task work round ownership race test Yun Lu
2026-09-18 8:13 ` sashiko-bot
2026-09-18 9:12 ` bot+bpf-ci
2026-09-18 16:50 ` [PATCH bpf-next 0/2] bpf: Fix task work round ownership race Mykyta Yatsenko
2026-09-18 17:17 ` Mykyta Yatsenko
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=c29d5338-ad68-4e0a-8cf6-4ae099fb633c@163.com \
--to=luyun_611@163.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=jolsa@kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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