From: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
To: bpf <bpf@vger.kernel.org>,
Saket Kumar Bhaskar <skb99@linux.ibm.com>,
Hari Bathini <hbathini@linux.ibm.com>,
Abhishek Dubey <adubey@linux.ibm.com>,
Alexei Starovoitov <ast@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Andrii Nakryiko <andrii@kernel.org>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
LKML <linux-kernel@vger.kernel.org>,
Ritesh Harjani <riteshh@linux.ibm.com>
Subject: bpf/selftests: test_access_variable_array breaks due to sched_domain::span removal
Date: Tue, 7 Apr 2026 21:42:02 +0530 [thread overview]
Message-ID: <3e129be5-d61e-4bc4-b691-8d69e2f58de6@linux.ibm.com> (raw)
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];
return 0;
}
I have tested this change, and it seems to be working as expected.
# ./test_progs -t access_variable_array
#1 access_variable_array:OK
Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED
Please note that this comes from my early days of working on upstream
kernel contributions, and I am still learning the BPF and scheduler
internals. My understanding here may be incomplete, so I wanted to
share this primarily to report the breakage I am seeing and propose a
possible direction for fixing the test.
I would appreciate any feedback on whether this is the right approach,
or if there is a more appropriate structure or hook to use for
preserving the variable-length array coverage in this selftest.
Regards,
Venkat.
next reply other threads:[~2026-04-07 16:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 16:12 Venkat Rao Bagalkote [this message]
2026-04-07 17:33 ` bpf/selftests: test_access_variable_array breaks due to sched_domain::span removal Alexei Starovoitov
2026-04-08 4:51 ` Saket Kumar Bhaskar
2026-04-08 7:56 ` Peter Zijlstra
2026-04-08 8:36 ` Alan Maguire
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=3e129be5-d61e-4bc4-b691-8d69e2f58de6@linux.ibm.com \
--to=venkat88@linux.ibm.com \
--cc=adubey@linux.ibm.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=hbathini@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maddy@linux.ibm.com \
--cc=peterz@infradead.org \
--cc=riteshh@linux.ibm.com \
--cc=skb99@linux.ibm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.