Thread (23 messages) 23 messages, 5 authors, 2025-08-14

Re: [bpf-next 6/6] selftests/bpf: Fix arena_spin_lock selftest failure

From: Alexei Starovoitov <hidden>
Date: 2025-08-08 16:27:13
Also in: bpf, linux-kselftest, lkml

On Fri, Aug 8, 2025 at 8:29 AM Saket Kumar Bhaskar [off-list ref] wrote:
On Thu, Aug 07, 2025 at 03:21:42PM -0700, Alexei Starovoitov wrote:
quoted
On Mon, Aug 4, 2025 at 11:29 PM Saket Kumar Bhaskar [off-list ref] wrote:
quoted
@@ -60,9 +65,16 @@ static void test_arena_spin_lock_size(int size)
                return;
        }

-       skel = arena_spin_lock__open_and_load();
-       if (!ASSERT_OK_PTR(skel, "arena_spin_lock__open_and_load"))
+       skel = arena_spin_lock__open();
+       if (!ASSERT_OK_PTR(skel, "arena_spin_lock__open"))
                return;
+
+       skel->rodata->nr_cpus = get_nprocs();
...
quoted
--- a/tools/testing/selftests/bpf/progs/bpf_arena_spin_lock.h
+++ b/tools/testing/selftests/bpf/progs/bpf_arena_spin_lock.h
@@ -20,8 +20,6 @@
 #define __arena __attribute__((address_space(1)))
 #endif

-extern unsigned long CONFIG_NR_CPUS __kconfig;
-
 /*
  * Typically, we'd just rely on the definition in vmlinux.h for qspinlock, but
  * PowerPC overrides the definition to define lock->val as u32 instead of
@@ -494,7 +492,7 @@ static __always_inline int arena_spin_lock(arena_spinlock_t __arena *lock)
 {
        int val = 0;

-       if (CONFIG_NR_CPUS > 1024)
+       if (nr_cpus > 1024)
                return -EOPNOTSUPP;
We cannot do this. It will make arena_spin_lock much harder to use.
BPF CI doesn't run on powerpc anyway, but you can document that this
test is disable by creating selftests/bpf/DENYLIST.powerpc.
Hi Alexie,
Sorry, I did not get it. Can you please help me to understand why it
makes arena_spin_lock harder to use.
because requiring user space to do
skel->rodata->nr_cpus = get_nprocs()
is a headache.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help