All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH v13 0/4] blk-iocost: BPF struct_ops cost model
@ 2026-11-06 12:23 Tao Cui
  2026-11-06 12:23 ` [RFC PATCH v13 1/4] blk-iocost: add BPF struct_ops cost model support Tao Cui
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Tao Cui @ 2026-11-06 12:23 UTC (permalink / raw)
  To: tj, josef, axboe, alexei.starovoitov
  Cc: cgroups, linux-block, linux-kernel, bpf, andrii, eddyz87, ast,
	daniel, linux-kselftest, cui.tao, cuitao, ameryhung

From: Tao Cui <cuitao@kylinos.cn>

This series lets a BPF program take over the cost model of one
device.  The BPF model provides calc_cost() for charged IOs plus two
transfer coefficients for the completion-time sizing, io.cost.model
selects between the attached model and the builtin one, and enabling
and disabling the controller stays with io.cost.qos.

The builtin model is a linear formula derived from a handful of device
parameters, and the right formula is device specific.  A BPF model can
be adapted to the device and updated without rebuilding the kernel.

The series is based on next-20261105.

Tao Cui (4):
  blk-iocost: add BPF struct_ops cost model support
  blk-iocost: add iocost_ioc_tick tracepoint for per-period device
    summary
  selftests/bpf: add iocost cost model test
  docs: cgroup-v2: document the iocost BPF cost model attachment

 Documentation/admin-guide/cgroup-v2.rst       |  49 +-
 MAINTAINERS                                   |   1 +
 block/Kconfig                                 |   4 +
 block/blk-iocost.c                            | 284 +++++-
 include/trace/events/iocost.h                 |  43 +
 tools/testing/selftests/bpf/config            |   2 +
 .../selftests/bpf/prog_tests/iocost_model.c   | 812 ++++++++++++++++++
 .../selftests/bpf/progs/iocost_model.c        | 180 ++++
 tools/testing/selftests/bpf/progs/iocost_ms.c | 197 +++++
 9 files changed, 1560 insertions(+), 12 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/iocost_model.c
 create mode 100644 tools/testing/selftests/bpf/progs/iocost_model.c
 create mode 100644 tools/testing/selftests/bpf/progs/iocost_ms.c

Changes since v12:

- the iocost_ioc_tick emission now sits inside the
  trace_iocost_ioc_tick_enabled() check, as tracepoints.rst requires,
  and the usage_pct trace field is widened to u64
- detaching a model resets the autop stepping timestamps, so the
  cooldown restarts fresh when the builtin model comes back
- iocost_bpf_supported() probes kernel BTF for the struct_ops wrapper
  type instead of /proc/config.gz, so an unavailable config no longer
  skips the tests, and the probe result is cached across cases
- the selftest sets up its private mount namespace and configfs mount
  once instead of stacking them across cases
- the multi-stream case feeds two interleaved streams and asserts that
  calc_cost() actually priced them
- the selftest cgroup names are created inside the per-pid work
  directory (leading '/'), nullb_create() rolls back the instance on
  its own error paths, and the streams test cleans up in the right
  order
- docs: document the attach rejection codes (-EOPNOTSUPP, -ENODEV,
  -EBUSY) and that root-cgroup IOs still use the attached model's
  transfer coefficients for completion-time sizing

Tested on next-20261105 (qemu x86_64): the selftests pass, and the 2x
example model doubles the charged cost over the builtin on a
rotational device (2.00x measured), returning to 1.00x after
"model=linear".

Link: https://lore.kernel.org/r/20261103132613.1952975-1-cui.tao@linux.dev # v12

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-11-09 13:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-06 12:23 [RFC PATCH v13 0/4] blk-iocost: BPF struct_ops cost model Tao Cui
2026-11-06 12:23 ` [RFC PATCH v13 1/4] blk-iocost: add BPF struct_ops cost model support Tao Cui
2026-11-06 12:48   ` sashiko-bot
2026-11-06 12:23 ` [RFC PATCH v13 2/4] blk-iocost: add iocost_ioc_tick tracepoint for per-period device summary Tao Cui
2026-11-06 12:56   ` bot+bpf-ci
2026-11-09 13:05     ` Tao Cui
2026-11-06 12:23 ` [RFC PATCH v13 3/4] selftests/bpf: add iocost cost model test Tao Cui
2026-11-06 12:44   ` sashiko-bot
2026-11-09 13:09     ` Tao Cui
2026-11-06 12:56   ` bot+bpf-ci
2026-11-06 12:23 ` [RFC PATCH v13 4/4] docs: cgroup-v2: document the iocost BPF cost model attachment Tao Cui

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.