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

From: Saket Kumar Bhaskar <[email-masked]>
Date: Fri, 8 Aug 2025 20:58:51 +0530

On Thu, Aug 07, 2025 at 03:21:42PM -0700, Alexei Starovoitov wrote:
> On Mon, Aug 4, 2025 at 11:29 PM Saket Kumar Bhaskar <[email-masked]> wrote:
> >
> > @@ -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();
> 
> ...
> 
> > --- 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.
Thanks,
Saket