From: sashiko-bot@kernel.org
To: "Tao Cui" <cui.tao@linux.dev>
Cc: mkoutny@suse.com, bpf@vger.kernel.org, tj@kernel.org, hannes@cmpxchg.org
Subject: Re: [RFC PATCH v8 2/4] selftests/bpf: add iocost cost model test
Date: Wed, 30 Sep 2026 08:02:46 +0000 [thread overview]
Message-ID: <20260930080246.A4D961F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260930075154.189958-3-cui.tao@linux.dev>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] bpf: tests exit without calling test__skip() on unsupported device
- [Low] bpf: unused array variables in write_cost_model consume stack space
--
commit e990a9d15cbbcc9c7a94ea98646f25abaa1003cf
Author: Tao Cui <cui.tao@linux.dev>
selftests/bpf: add iocost cost model test
This commit adds an iocost cost model test for BPF, including a double-cost
linear HDD formula and a multi-stream sequentiality detection model. It verifies
attaching, detaching, and cost readbacks on a block device.
> diff --git a/tools/testing/selftests/bpf/prog_tests/iocost_model.c b/tools/testing/selftests/bpf/prog_tests/iocost_model.c
> new file mode 100644
> index 0000000000000..5b7b1282fcb74
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/iocost_model.c
[ ... ]
> +static int write_cost_model(const char *dev, const char *what)
> +{
> + char buf[128], line[256], word[256];
[Severity: Low]
Are the arrays line and word needed here? They consume 512 bytes of stack
space but do not appear to be used anywhere in write_cost_model().
> + FILE *fp;
> + int err = 0;
> +
> + snprintf(buf, sizeof(buf), "%s %s", dev, what);
> + fp = fopen("/sys/fs/cgroup/io.cost.model", "w");
[ ... ]
> +void serial_test_iocost_model(void)
> +{
> + struct iocost_model *skel, *second;
[ ... ]
> + err = iocost_model__attach(skel);
> + if (err == -EOPNOTSUPP) {
> + printf("%s: device is not blk-mq or iocost unavailable, skipping\n",
> + __func__);
> + iocost_model__destroy(skel);
> + return;
[Severity: Medium]
Without calling test__skip(), the test runner might incorrectly report this
test as PASSED rather than SKIPPED when the device lacks support.
Should this error path call test__skip() before returning?
> + }
> + if (ASSERT_OK(err, "attach")) {
[ ... ]
> +void serial_test_iocost_model_streams(void)
> +{
> + struct iocost_ms *skel;
[ ... ]
> + err = iocost_ms__attach(skel);
> + if (err == -EOPNOTSUPP) {
> + printf("%s: device is not blk-mq or iocost unavailable, skipping\n",
> + __func__);
> + iocost_ms__destroy(skel);
> + return;
[Severity: Medium]
Similarly, does this error path also need to call test__skip() so the test
runner knows the execution was skipped rather than successfully passed?
> + }
> + if (ASSERT_OK(err, "attach")) {
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260930075154.189958-1-cui.tao@linux.dev?part=2
next prev parent reply other threads:[~2026-09-30 8:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 7:51 [RFC PATCH v8 0/4] blk-iocost: add BPF struct_ops cost model support Tao Cui
2026-09-30 7:51 ` [RFC PATCH v8 1/4] " Tao Cui
2026-09-30 8:11 ` sashiko-bot
2026-09-30 11:50 ` Tao Cui
2026-10-01 0:20 ` Tejun Heo
2026-10-02 14:17 ` Tao Cui
2026-09-30 7:51 ` [RFC PATCH v8 2/4] selftests/bpf: add iocost cost model test Tao Cui
2026-09-30 8:02 ` sashiko-bot [this message]
2026-10-01 0:20 ` Tejun Heo
2026-10-02 14:20 ` Tao Cui
2026-09-30 7:51 ` [RFC PATCH v8 3/4] blk-iocost: add iocost_ioc_tick tracepoint for per-period device summary Tao Cui
2026-10-01 0:20 ` Tejun Heo
2026-10-02 14:22 ` Tao Cui
2026-09-30 7:51 ` [RFC PATCH v8 4/4] docs: cgroup-v2: document the iocost BPF cost model attachment Tao Cui
2026-09-30 8:45 ` bot+bpf-ci
2026-10-01 0:20 ` Tejun Heo
2026-10-02 14:23 ` 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=20260930080246.A4D961F000FF@smtp.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