From: Tao Cui <cui.tao@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
tj@kernel.org, josef@toxicopanda.com, axboe@kernel.dk,
ameryhung@gmail.com
Cc: cui.tao@linux.dev, cgroups@vger.kernel.org,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org, andrii@kernel.org, eddyz87@gmail.com,
daniel@iogearbox.net, linux-kselftest@vger.kernel.org,
cuitao@kylinos.cn
Subject: Re: [RFC PATCH v5 1/5] blk-iocost: add BPF struct_ops cost model support
Date: Sat, 19 Sep 2026 15:34:52 +0800 [thread overview]
Message-ID: <748ca00e-61af-4698-86a9-cb28a41c7471@linux.dev> (raw)
In-Reply-To: <DLIK37JYD35X.3NZ4ZHTHDKAFX@gmail.com>
Hi Alexei,
在 2026/9/18 23:43, Alexei Starovoitov 写道:
> On Fri, Sep 18, 2026 at 11:17 AM Tao Cui <cui.tao@linux.dev> wrote:
>> The registration and binding model follows the TCP congestion
>> model registration pattern: registering a struct_ops makes the model
>> available by its name (char name[IOCOST_MODEL_NAME_LEN], validated at
>> init_member), while
>> io.cost.model binds one registered model to a device with
>> "model=<name>" and unbinds with "model=linear" or "ctrl=auto/user".
>> Unregistering a model removes it from the registry, but its name
>
> I don't think it's what Tejun asked for in v1. He asked for a per-device
> struct_ops instance where attaching switches the device to bpf and
> detaching switches it back. Instead there is a global name registry,
> a lifecycle list, an "unregistered but still bound" state and a
> refcount_t on top of bpf_struct_ops_get(), and every version since v3
> had a lifetime bug in exactly that code.
> Do it like hid_bpf_ops does with hid_id: device in the struct_ops,
> bind in .reg, unbind in .unreg, and le
> t struct_ops own the lifetime.
>
Thanks for pointing this out.
You are right. I misunderstood Tejun's comment from v1. I took
"per-device" as selecting a registered model by name for each device,
which led to the current registry/lifecycle design.
My original implementation followed the tcp-cc style named model
approach, but that was not what Tejun was suggesting. The intended
model should be a per-device struct_ops instance, with attach/detach
controlling the switch between the BPF model and the builtin model,
and the struct_ops core owning the lifetime.
> pls wait for Tejun's feedback before respinning.
>
I'll rework the design in that direction and wait for Tejun's feedback
before sending another revision.
Thanks,
Tao
> pw-bot: cr
next prev parent reply other threads:[~2026-09-19 7:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 3:17 [RFC PATCH v5 0/5] blk-iocost: BPF struct_ops cost model Tao Cui
2026-09-18 3:17 ` [RFC PATCH v5 1/5] blk-iocost: add BPF struct_ops cost model support Tao Cui
2026-09-18 15:43 ` Alexei Starovoitov
2026-09-19 7:34 ` Tao Cui [this message]
2026-09-18 3:17 ` [RFC PATCH v5 2/5] selftests/bpf: add iocost cost model test Tao Cui
2026-09-18 3:17 ` [RFC PATCH v5 3/5] blk-iocost: add iocost_ioc_tick tracepoint for per-period device summary Tao Cui
2026-09-18 3:17 ` [RFC PATCH v5 4/5] selftests/bpf: add multi-stream sequentiality example model Tao Cui
2026-09-18 3:17 ` [RFC PATCH v5 5/5] docs: cgroup-v2: document io.cost model=<name> binding Tao Cui
2026-09-18 5:48 ` [RFC PATCH v5 0/5] blk-iocost: BPF struct_ops cost model Tao Cui
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=748ca00e-61af-4698-86a9-cb28a41c7471@linux.dev \
--to=cui.tao@linux.dev \
--cc=alexei.starovoitov@gmail.com \
--cc=ameryhung@gmail.com \
--cc=andrii@kernel.org \
--cc=axboe@kernel.dk \
--cc=bpf@vger.kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=cuitao@kylinos.cn \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=josef@toxicopanda.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=tj@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 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®