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: [RFC PATCH v13 3/4] selftests/bpf: add iocost cost model test
Date: Fri, 06 Nov 2026 12:44:54 +0000 [thread overview]
Message-ID: <sashiko-outbox-201410@kernel.org> (raw)
In-Reply-To: <20261106122356.3224638-4-cui.tao@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] selftests/bpf: pread() in serial_test_iocost_model_streams()
hits page cache
--
commit 371817062abb0b837764b9a93458f77eb2057dd2
Author: Tao Cui <cuitao@kylinos.cn>
selftests/bpf: add iocost cost model test
This commit adds BPF selftests and two example struct_ops cost models for
blk-iocost using a configfs-backed null_blk 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..a714507c040e3
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/iocost_model.c
[ ... ]
> +void serial_test_iocost_model_streams(void)
> +{
[ ... ]
> + devfd = open(path, O_RDONLY);
> + if (ASSERT_OK(devfd < 0 ? -errno : 0, "open_dev_ms")) {
> + char iobuf[4096];
> + unsigned long long u1 = 0, u2 = 0;
> +
> + ASSERT_OK(read_cost_usage("/iocost_ms",
> + dev, &u1), "cost_usage_pre");
> + for (i = 0; i < 500; i++)
> + (void)read(devfd, iobuf, sizeof(iobuf));
> + /*
> + * Two interleaved sequential streams: exercise the
> + * stream table, not just a single cursor.
> + */
> + for (i = 0; i < 200; i++) {
> + (void)pread(devfd, iobuf, sizeof(iobuf),
> + (i + 1) * sizeof(iobuf));
> + (void)pread(devfd, iobuf, sizeof(iobuf),
> + (1 << 20) +
> + (i + 1) * sizeof(iobuf));
> + }
[Severity: Medium]
Do these interleaved pread() calls get satisfied from the block device page
cache without reaching iocost_ms_calc_cost()?
Because devfd is opened without O_DIRECT, the preceding 500 sequential
4096-byte read() calls populate the page cache for bytes [0, 2048000).
Both pread() streams read within that cached range ([4096, 823296) and
[1052672, 1871872)), so no interleaved bios are submitted to the block
layer and the multi-stream slot table is not exercised while the
subsequent assertions pass from the initial read() loop alone.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261106122356.3224638-1-cui.tao@linux.dev?part=3
next prev parent reply other threads:[~2026-11-06 12:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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-201410@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