Re: [PATCH 08/10] sched_ext: Add selftest for blocked donor admission

[email protected] Mon, 13 Jul 2026 16:34:08 +0000
Newsgroups dev.linux.lists.sched-ext
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The selftest fails to verify strict CPU affinity of blocked donors during the same-CPU topology test due to a flawed conditional check.
--

--- Patch [8]: [PATCH 08/10] sched_ext: Add selftest for blocked donor admission ---
commit 933cd9c1a4c089059db1cd4edea0c388cf1d4510
Author: Andrea Righi <[email protected]>
Subject: sched_ext: Add selftest for blocked donor admission

This commit introduces a selftest for the SCX_OPS_ENQ_BLOCKED scheduler
interface, testing blocked-donor admission requests. It sets up a priority
inversion scenario using a custom BPF scheduler and a kernel module to
exercise proxy execution. The test evaluates both same-CPU and cross-CPU
topologies.

> diff --git a/tools/testing/selftests/sched_ext/enq_blocked.c b/tools/testing/selftests/sched_ext/enq_blocked.c
> new file mode 100644
> index 0000000000000..4df9671222831
> --- /dev/null
> +++ b/tools/testing/selftests/sched_ext/enq_blocked.c
[ ... ]
> +	if (status == SCX_TEST_PASS) {
> +		if (enq_blocked && proxy_enabled && !nr_blocked) {
> +			SCX_ERR("ops.enqueue() did not receive the blocked donor");
> +			status = SCX_TEST_FAIL;
> +		} else if ((!enq_blocked || !proxy_enabled) && nr_blocked) {
> +			SCX_ERR("ops.enqueue() unexpectedly received %llu blocked donors",
> +				(unsigned long long)nr_blocked);
> +			status = SCX_TEST_FAIL;
> +		} else if (cross_cpu && nr_blocked_other_cpu) {

[Severity: Medium]
Should the unexpected CPU enqueue verification be restricted solely to the
cross-CPU topology test? 

If cross_cpu is false in the same-CPU test configuration, this conditional
bypasses the check for nr_blocked_other_cpu. It seems this might silently
ignore a regression if a pinned proxy donor is somehow incorrectly migrated
and enqueued on an unexpected CPU during the same-CPU test. 

Would it make sense to remove the cross_cpu condition here to ensure strict
CPU affinity is validated across both test configurations?

> +			SCX_ERR("Blocked donor had %llu enqueues on unexpected CPUs",
> +				(unsigned long long)nr_blocked_other_cpu);
> +			status = SCX_TEST_FAIL;
> +		}
> +	}

-- 
Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=8