BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tao Cui" <cui.tao@linux.dev>
Cc: bpf@vger.kernel.org, tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com
Subject: Re: [PATCH v15 4/4] docs: cgroup-v2: document the iocost BPF cost model attachment
Date: Thu, 03 Dec 2026 15:19:06 +0000	[thread overview]
Message-ID: <sashiko-outbox-248093@kernel.org> (raw)
In-Reply-To: <20261203150338.2625598-5-cui.tao@linux.dev>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Low] docs: cgroup-v2: io.cost.model bpf readback inaccurately omits
  ctrl
- [Low] docs: cgroup-v2: io.cost.model omits BPF_F_LINK requirement for
  attach
- [Low] docs: cgroup-v2: dev is supplied on struct_ops map update, not
  map creation
--

commit 647cd1dc2151194c42e7d75e366a48e8b9681de0
Author: Tao Cui <cuitao@kylinos.cn>

docs: cgroup-v2: document the iocost BPF cost model attachment

This commit documents BPF cost model attachment in the io.cost.qos and
io.cost.model sections of the cgroup v2 administration guide.

> diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst
> index 9e3c67b02ae2e..c83f6fba16c1e 100644
> --- a/Documentation/admin-guide/cgroup-v2.rst
> +++ b/Documentation/admin-guide/cgroup-v2.rst

[ ... ]

> @@ -2111,13 +2112,50 @@ IO Interface Files

[ ... ]

> +	When BPF cost model support is available, a BPF cost model
> +	can be bound to a device by attaching an
> +	"iocost_model_ops" struct_ops carrying the whole disk's
> +	major:minor as encoded by makedev(3) in its "dev" member (a
> +	partition's major:minor is rejected).  The loader supplies
> +	"dev" when the map is created and it cannot be changed
> +	afterward.  Attaching creates the controller if needed, like an

[Severity: Low]
Is "dev" actually supplied when the map is created?

BPF_MAP_CREATE only takes map metadata and BTF type IDs.  The "dev"
member is supplied on the single permitted BPF_MAP_UPDATE_ELEM call
(__bpf_struct_ops_map_update_elem() -> ioc_bpf_init_member()), after
which further updates fail with -EBUSY.

Even libbpf sends "dev" via bpf_map_update_elem() in
bpf_map__attach_struct_ops().  Rewording this to say the loader
supplies "dev" when populating the struct_ops map (or before loading
the object with libbpf) would match both workflows.

> +	io.cost.model write does, switches the device's pricing to the
> +	model and populates the device's line in this file and in
> +	"io.cost.qos" if it did not exist yet.  Attaching fails with
> +	-EBUSY if the device already has a model attached, with
> +	-EINVAL if the model fails its attach-time validation, with
> +	-EOPNOTSUPP if dev names a partition or a device without a
> +	multiqueue queue, and with -ENODEV if dev does not name an
> +	existing device or if the device has gone away.  Updating the

[Severity: Low]
Should this also document that link-based attachment (BPF_F_LINK) is
required?

ioc_bpf_reg() returns -EOPNOTSUPP when link is NULL, which happens for
struct_ops maps created without BPF_F_LINK (e.g., SEC(".struct_ops")
instead of SEC(".struct_ops.link")).  Since other struct_ops types
allow non-link attachment, this can produce an undocumented -EOPNOTSUPP.

[ ... ]

> @@ -2125,7 +2163,9 @@ IO Interface Files
>  	automatic changes are disabled.
>  
>  	When "model" is "linear", the following model parameters are
> -	defined.
> +	defined.  They remain writable while "model" is "bpf"; while
> +	"bpf" is selected, the readback shows only "model=bpf" and the
> +	attached model's "name".

[Severity: Low]
Does the readback actually omit "ctrl" while "bpf" is selected?

ioc_cost_model_prfill() unconditionally prints "ctrl=user" or
"ctrl=auto" before "model=bpf name=...".  Only the linear model
parameters (rbps, wbps, etc.) are omitted.

The commit message also says this documents that "ctrl" keeps
describing the coefficients while attached, which this sentence
contradicts.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203150338.2625598-1-cui.tao@linux.dev?part=4

      reply	other threads:[~2026-12-03 15:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 15:03 [PATCH v15 0/4] blk-iocost: BPF struct_ops cost model Tao Cui
2026-12-03 15:03 ` [PATCH v15 1/4] blk-iocost: add BPF struct_ops cost model support Tao Cui
2026-12-03 15:03 ` [PATCH v15 2/4] blk-iocost: add iocost_ioc_tick tracepoint for per-period device summary Tao Cui
2026-12-03 15:03 ` [PATCH v15 3/4] selftests/bpf: add iocost cost model test Tao Cui
2026-12-03 15:03 ` [PATCH v15 4/4] docs: cgroup-v2: document the iocost BPF cost model attachment Tao Cui
2026-12-03 15:19   ` sashiko-bot [this message]

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=sashiko-outbox-248093@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=cui.tao@linux.dev \
    --cc=hannes@cmpxchg.org \
    --cc=mkoutny@suse.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --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