Re: [PATCH v6 37/37] selftests/sched: Add a test of SCHED_DEADLINE bandwidth accounting
From: sashiko-bot
Date: Mon Nov 16 2026 - 14:49:30 EST
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/sched: unconditional cpu_up() and hotplug check in
fallback_case()
--
commit a082e176a7ad72cb248a92c19ae446e62c656620
Author: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
selftests/sched: Add a test of SCHED_DEADLINE bandwidth accounting
This commit adds deadline_bw_test to test SCHED_DEADLINE bandwidth
accounting across priority inheritance, parameter changes, cpuset moves,
deaths, yields, runtime overruns, reclaiming, fair servers, and CPU
hotplug.
Link: https://github.com/jlelli/sched-deadline-tests
> diff --git a/tools/testing/selftests/sched/deadline/deadline_bw_test.c b/tools/testing/selftests/sched/deadline/deadline_bw_test.c
> new file mode 100644
> index 0000000000000..19c61a3a95296
> --- /dev/null
> +++ b/tools/testing/selftests/sched/deadline/deadline_bw_test.c
[ ... ]
> +static int fallback_case(enum fb_mode mode)
> +{
> + int in_b = mode == FB_LAST_H || mode == FB_PART_H || mode == FB_STAY_K;
> + int off_cpu;
> + int on_h = mode == FB_ON_H || mode == FB_MASK_H || in_b;
> + int no_offline = mode == FB_MASK_H || mode == FB_LAST_H || mode == FB_PART_H;
> + char cg_q[PATH_MAX];
> + int on_i1 = mode == FB_ON_I1;
> + char cg_b[PATH_MAX], cg_c[PATH_MAX], path[PATH_MAX + 32], buf[256], one[16];
> + long long def0, hk0, def_off = 0, hk_off = 0, def_ref, hk_ref, def, hk, bw;
> + int fd[2], ret = KSFT_SKIP, added = 0, made = 0, w, at, err;
> + pid_t pid = -1;
> +
> + if (!root[0] || fallback_cpus(!no_offline)) {
> + ksft_print_msg("needs isolcpus=domain: 2 isolated, 2 housekeeping CPUs%s\n",
> + no_offline ? "" : ", CPU hotplug");
> + return KSFT_SKIP;
> + }
> + off_cpu = mode == FB_STAY_K ? fb_h : fb_i1;
> + if ((mode == FB_LAST_H || mode == FB_STAY_K) && !cpu_hotpluggable(fb_h)) {
> + ksft_print_msg("CPU %d cannot go offline\n", fb_h);
> + return KSFT_SKIP;
> + }
[ ... ]
> + reap(pid);
> + pid = -1;
> + sleep_ns(3 * PERIOD);
> + def = total_bw_of(fb_i2);
> + hk = total_bw_of(fb_k);
> + if (def != def_ref || hk != hk_ref) {
> + ksft_print_msg("task gone: total_bw %lld, %lld, not %lld, %lld\n",
> + def, hk, def_ref, hk_ref);
> + ret = KSFT_FAIL;
> + }
> +out_up:
> + reap(pid);
> + cpu_up(off_cpu);
> + pid = -1;
[Severity: Low]
Should cpu_up(off_cpu) at out_up be guarded by !no_offline?
For FB_MASK_H, FB_LAST_H, and FB_PART_H, off_cpu is never taken offline
(and mask_out_refused and partition_takes_refused have no_hp = 1), so
falling through to out_up attempts to write to the sysfs online file of
fb_i1 and logs an error when fb_i1 is not hotpluggable.
Also, for FB_STAY_K, off_cpu is fb_h rather than fb_i1, but passing
!no_offline to fallback_cpus() requires an isolated CPU to be
hotpluggable and skips hotplug_keeps_root_domain if neither isolated CPU
supports hotplug.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116190549.230119-1-mathieu.desnoyers@xxxxxxxxxxxx?part=37