Re: bpf/selftests: test_access_variable_array breaks due to sched_domain::span removal

From: Alexei Starovoitov

Date: Tue Apr 07 2026 - 13:34:25 EST


On Tue, Apr 7, 2026 at 9:12 AM Venkat Rao Bagalkote
<venkat88@xxxxxxxxxxxxx> wrote:
>
> Hi,
>
>
> While running BPF selftests on current linux-next, I noticed that
> test_access_variable_array fails to build due to reliance on
> struct sched_domain::span, which is no longer appers to be BTF-visible
> after recent
> scheduler refactoring.
>
> The Build error I am seeing is:
>
> progs/test_access_variable_array.c:14:13: error: no member named 'span'
> in 'struct sched_domain' CLNG-BPF [test_progs] test_check_mtu.bpf.o
>
> 14 | span = sd->span[0];
> | ~~ ^
>
> Below is a proposed update to the test that switches from
> sched_domain::span to sched_group::cpumask. This preserves the original
> intent of validating variable-length array access via BTF while avoiding
> reliance on removed scheduler internals.
>
>
> diff --git
> a/tools/testing/selftests/bpf/progs/test_access_variable_array.c
> b/tools/testing/selftests/bpf/progs/test_access_variable_array.c
> index 326b7d1f496a..c9f345ccde3c 100644
> --- a/tools/testing/selftests/bpf/progs/test_access_variable_array.c
> +++ b/tools/testing/selftests/bpf/progs/test_access_variable_array.c
> @@ -4,14 +4,18 @@
> #include "vmlinux.h"
> #include <bpf/bpf_helpers.h>
> #include <bpf/bpf_tracing.h>
> +#include <bpf/bpf_core_read.h>
>
> -unsigned long span = 0;
> +unsigned long cpumask0 = 0;
>
> -SEC("fentry/sched_balance_rq")
> -int BPF_PROG(fentry_fentry, int this_cpu, struct rq *this_rq,
> - struct sched_domain *sd)
> +SEC("fentry/sched_balance_find_dst_group_cpu")
> +int BPF_PROG(fentry_fentry, struct sched_group *sg, struct task_struct *p,
> + int this_cpu)
> {
> - span = sd->span[0];
> + unsigned long *mask;
> + /* Read pointer to variable-length CPU mask */
> + mask = BPF_CORE_READ(sg, cpumask);
> + cpumask0 = mask[0];

No. That defeats the point of the test.
It tests [] array in the kernel struct.
Just make one in testmod.ko and access that.