Skip to contentSkip to conversation

selftests/bpf fails to compile

bpf-next Venkat Rao Bagalkote 3 participants 4 messages Mar 10, 2025 – Mar 11, 2025 BPF

lore
Share & tools
lore
#0 lore raw

Greetings!!!

selftests/bpf fails to compile with below error on bpf-next repo with commit head: f28214603dc6c09b3b5e67b1ebd5ca83ad943ce3

Repo link: https://web.git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/

Reverting below commit resolves the issue.

Commit ID: 48b3be8d7f82bea6affe6b9f11ee67380b55ede8

Errors:

make

  CLNG-BPF [test_progs] arena_spin_lock.bpf.o
In file included from progs/arena_spin_lock.c:7:
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:122:8: error: member reference base type '__attribute__((address_space(1))) u32' (aka '__attribute__((address_space(1))) unsigned int') is not a structure or union 122 |         old = atomic_read(&lock->val);
      |               ^~~~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:126:37: note: expanded from macro 'atomic_read'
  126 | #define atomic_read(p) READ_ONCE((p)->counter)
      |                        ~~~~~~~~~~~~~^~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:43:41: note: expanded from macro 'READ_ONCE'
   43 | #define READ_ONCE(x) (*(volatile typeof(x) *)&(x))
      |                                         ^
In file included from progs/arena_spin_lock.c:7:
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:122:8: error: member reference base type '__attribute__((address_space(1))) u32' (aka '__attribute__((address_space(1))) unsigned int') is not a structure or union 122 |         old = atomic_read(&lock->val);
      |               ^~~~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:126:37: note: expanded from macro 'atomic_read'
  126 | #define atomic_read(p) READ_ONCE((p)->counter)
      |                        ~~~~~~~~~~~~~^~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:43:48: note: expanded from macro 'READ_ONCE'
   43 | #define READ_ONCE(x) (*(volatile typeof(x) *)&(x))
      |                                                ^
In file included from progs/arena_spin_lock.c:7:
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:134:12: error: member reference base type '__attribute__((address_space(1))) u32' (aka '__attribute__((address_space(1))) unsigned int') is not a structure or union 134 |         } while (!atomic_try_cmpxchg_relaxed(&lock->val, &old, new));
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:135:26: note: expanded from macro 'atomic_try_cmpxchg_relaxed'
  135 |         try_cmpxchg_relaxed(&(p)->counter, pold, new)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:58:55: note: expanded from macro 'try_cmpxchg_relaxed'
   58 | #define try_cmpxchg_relaxed(p, pold, new) try_cmpxchg(p, pold, new)
      | ~~~~~~~~~~~~^~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:52:21: note: expanded from macro 'try_cmpxchg'
   52 |                 __unqual_typeof(*(p)) __r = cmpxchg(p, __o, new); \
      |                 ~~~~~~~~~~~~~~~~~~^~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:31:19: note: expanded from macro '__unqual_typeof'
   31 |         typeof(_Generic((x),                            \
      |                          ^
In file included from progs/arena_spin_lock.c:7:
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:134:12: error: member reference base type '__attribute__((address_space(1))) u32' (aka '__attribute__((address_space(1))) unsigned int') is not a structure or union 134 |         } while (!atomic_try_cmpxchg_relaxed(&lock->val, &old, new));
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:135:26: note: expanded from macro 'atomic_try_cmpxchg_relaxed'
  135 |         try_cmpxchg_relaxed(&(p)->counter, pold, new)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:58:55: note: expanded from macro 'try_cmpxchg_relaxed'
   58 | #define try_cmpxchg_relaxed(p, pold, new) try_cmpxchg(p, pold, new)
      | ~~~~~~~~~~~~^~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:52:21: note: expanded from macro 'try_cmpxchg'
   52 |                 __unqual_typeof(*(p)) __r = cmpxchg(p, __o, new); \
      |                 ~~~~~~~~~~~~~~~~~~^~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:38:20: note: expanded from macro '__unqual_typeof'
   38 |                 default: (typeof(x))0))
      |                                  ^
In file included from progs/arena_spin_lock.c:7:
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:134:12: error: member reference base type '__attribute__((address_space(1))) u32' (aka '__attribute__((address_space(1))) unsigned int') is not a structure or union 134 |         } while (!atomic_try_cmpxchg_relaxed(&lock->val, &old, new));
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:135:26: note: expanded from macro 'atomic_try_cmpxchg_relaxed'
  135 |         try_cmpxchg_relaxed(&(p)->counter, pold, new)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:58:55: note: expanded from macro 'try_cmpxchg_relaxed'
   58 | #define try_cmpxchg_relaxed(p, pold, new) try_cmpxchg(p, pold, new)
      | ~~~~~~~~~~~~^~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:52:39: note: expanded from macro 'try_cmpxchg'
   52 |                 __unqual_typeof(*(p)) __r = cmpxchg(p, __o, new); \
      | ~~~~~~~~^~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:47:59: note: expanded from macro 'cmpxchg'
   47 | #define cmpxchg(p, old, new) __sync_val_compare_and_swap((p), old, new)
      | ^
In file included from progs/arena_spin_lock.c:7:
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:150:19: error: no member named 'pending' in 'struct qspinlock'
  150 |         WRITE_ONCE(lock->pending, 0);
      |                    ~~~~  ^
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:45:48: note: expanded from macro 'WRITE_ONCE'
   45 | #define WRITE_ONCE(x, val) ((*(volatile typeof(x) *)&(x)) = (val))
      |                                                ^
In file included from progs/arena_spin_lock.c:7:
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:150:19: error: no member named 'pending' in 'struct qspinlock'
  150 |         WRITE_ONCE(lock->pending, 0);
      |                    ~~~~  ^
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:45:55: note: expanded from macro 'WRITE_ONCE'
   45 | #define WRITE_ONCE(x, val) ((*(volatile typeof(x) *)&(x)) = (val))
      |                                                       ^
In file included from progs/arena_spin_lock.c:7:
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:163:19: error: no member named 'locked_pending' in 'struct qspinlock'
  163 |         WRITE_ONCE(lock->locked_pending, _Q_LOCKED_VAL);
      |                    ~~~~  ^
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:45:48: note: expanded from macro 'WRITE_ONCE'
   45 | #define WRITE_ONCE(x, val) ((*(volatile typeof(x) *)&(x)) = (val))
      |                                                ^
In file included from progs/arena_spin_lock.c:7:
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:163:19: error: no member named 'locked_pending' in 'struct qspinlock'
  163 |         WRITE_ONCE(lock->locked_pending, _Q_LOCKED_VAL);
      |                    ~~~~  ^
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:45:55: note: expanded from macro 'WRITE_ONCE'
   45 | #define WRITE_ONCE(x, val) ((*(volatile typeof(x) *)&(x)) = (val))
      |                                                       ^
In file included from progs/arena_spin_lock.c:7:
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:182:8: error: member reference base type '__attribute__((address_space(1))) u32' (aka '__attribute__((address_space(1))) unsigned int') is not a structure or union 182 |         old = atomic_read(&lock->val);
      |               ^~~~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:126:37: note: expanded from macro 'atomic_read'
  126 | #define atomic_read(p) READ_ONCE((p)->counter)
      |                        ~~~~~~~~~~~~~^~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:43:41: note: expanded from macro 'READ_ONCE'
   43 | #define READ_ONCE(x) (*(volatile typeof(x) *)&(x))
      |                                         ^
In file included from progs/arena_spin_lock.c:7:
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:182:8: error: member reference base type '__attribute__((address_space(1))) u32' (aka '__attribute__((address_space(1))) unsigned int') is not a structure or union 182 |         old = atomic_read(&lock->val);
      |               ^~~~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:126:37: note: expanded from macro 'atomic_read'
  126 | #define atomic_read(p) READ_ONCE((p)->counter)
      |                        ~~~~~~~~~~~~~^~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:43:48: note: expanded from macro 'READ_ONCE'
   43 | #define READ_ONCE(x) (*(volatile typeof(x) *)&(x))
      |                                                ^
In file included from progs/arena_spin_lock.c:7:
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:190:12: error: member reference base type '__attribute__((address_space(1))) u32' (aka '__attribute__((address_space(1))) unsigned int') is not a structure or union 190 |         } while (!atomic_try_cmpxchg_acquire(&lock->val, &old, new));
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:138:26: note: expanded from macro 'atomic_try_cmpxchg_acquire'
  138 |         try_cmpxchg_acquire(&(p)->counter, pold, new)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:60:55: note: expanded from macro 'try_cmpxchg_acquire'
   60 | #define try_cmpxchg_acquire(p, pold, new) try_cmpxchg(p, pold, new)
      | ~~~~~~~~~~~~^~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:52:21: note: expanded from macro 'try_cmpxchg'
   52 |                 __unqual_typeof(*(p)) __r = cmpxchg(p, __o, new); \
      |                 ~~~~~~~~~~~~~~~~~~^~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:31:19: note: expanded from macro '__unqual_typeof'
   31 |         typeof(_Generic((x),                            \
      |                          ^
In file included from progs/arena_spin_lock.c:7:
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:190:12: error: member reference base type '__attribute__((address_space(1))) u32' (aka '__attribute__((address_space(1))) unsigned int') is not a structure or union 190 |         } while (!atomic_try_cmpxchg_acquire(&lock->val, &old, new));
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:138:26: note: expanded from macro 'atomic_try_cmpxchg_acquire'
  138 |         try_cmpxchg_acquire(&(p)->counter, pold, new)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:60:55: note: expanded from macro 'try_cmpxchg_acquire'
   60 | #define try_cmpxchg_acquire(p, pold, new) try_cmpxchg(p, pold, new)
      | ~~~~~~~~~~~~^~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:52:21: note: expanded from macro 'try_cmpxchg'
   52 |                 __unqual_typeof(*(p)) __r = cmpxchg(p, __o, new); \
      |                 ~~~~~~~~~~~~~~~~~~^~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:38:20: note: expanded from macro '__unqual_typeof'
   38 |                 default: (typeof(x))0))
      |                                  ^
In file included from progs/arena_spin_lock.c:7:
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:190:12: error: member reference base type '__attribute__((address_space(1))) u32' (aka '__attribute__((address_space(1))) unsigned int') is not a structure or union 190 |         } while (!atomic_try_cmpxchg_acquire(&lock->val, &old, new));
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:138:26: note: expanded from macro 'atomic_try_cmpxchg_acquire'
  138 |         try_cmpxchg_acquire(&(p)->counter, pold, new)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:60:55: note: expanded from macro 'try_cmpxchg_acquire'
   60 | #define try_cmpxchg_acquire(p, pold, new) try_cmpxchg(p, pold, new)
      | ~~~~~~~~~~~~^~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:52:39: note: expanded from macro 'try_cmpxchg'
   52 |                 __unqual_typeof(*(p)) __r = cmpxchg(p, __o, new); \
      | ~~~~~~~~^~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:47:59: note: expanded from macro 'cmpxchg'
   47 | #define cmpxchg(p, old, new) __sync_val_compare_and_swap((p), old, new)
      | ^
In file included from progs/arena_spin_lock.c:7:
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:205:12: error: member reference base type '__attribute__((address_space(1))) u32' (aka '__attribute__((address_space(1))) unsigned int') is not a structure or union 205 |         int val = atomic_read(&lock->val);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:126:37: note: expanded from macro 'atomic_read'
  126 | #define atomic_read(p) READ_ONCE((p)->counter)
      |                        ~~~~~~~~~~~~~^~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:43:41: note: expanded from macro 'READ_ONCE'
   43 | #define READ_ONCE(x) (*(volatile typeof(x) *)&(x))
      |                                         ^
In file included from progs/arena_spin_lock.c:7:
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:205:12: error: member reference base type '__attribute__((address_space(1))) u32' (aka '__attribute__((address_space(1))) unsigned int') is not a structure or union 205 |         int val = atomic_read(&lock->val);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:126:37: note: expanded from macro 'atomic_read'
  126 | #define atomic_read(p) READ_ONCE((p)->counter)
      |                        ~~~~~~~~~~~~~^~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:43:48: note: expanded from macro 'READ_ONCE'
   43 | #define READ_ONCE(x) (*(volatile typeof(x) *)&(x))
      |                                                ^
In file included from progs/arena_spin_lock.c:7:
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:210:16: error: member reference base type '__attribute__((address_space(1))) u32' (aka '__attribute__((address_space(1))) unsigned int') is not a structure or union 210 |         return likely(atomic_try_cmpxchg_acquire(&lock->val, &val, _Q_LOCKED_VAL));
      | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:138:26: note: expanded from macro 'atomic_try_cmpxchg_acquire'
  138 |         try_cmpxchg_acquire(&(p)->counter, pold, new)
      |                                 ^ ~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:60:55: note: expanded from macro 'try_cmpxchg_acquire'
   60 | #define try_cmpxchg_acquire(p, pold, new) try_cmpxchg(p, pold, new)
      |                                                       ^
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:52:21: note: expanded from macro 'try_cmpxchg'
   52 |                 __unqual_typeof(*(p)) __r = cmpxchg(p, __o, new); \
      |                                   ^
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:31:19: note: expanded from macro '__unqual_typeof'
   31 |         typeof(_Generic((x),                            \
      |                          ^
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:77:39: note: expanded from macro 'likely'
   77 | #define likely(x) __builtin_expect(!!(x), 1)
      |                                       ^
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:210:16: error: member reference base type '__attribute__((address_space(1))) u32' (aka '__attribute__((address_space(1))) unsigned int') is not a structure or union 210 |         return likely(atomic_try_cmpxchg_acquire(&lock->val, &val, _Q_LOCKED_VAL));
      | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:138:26: note: expanded from macro 'atomic_try_cmpxchg_acquire'
  138 |         try_cmpxchg_acquire(&(p)->counter, pold, new)
      |                                 ^ ~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:60:55: note: expanded from macro 'try_cmpxchg_acquire'
   60 | #define try_cmpxchg_acquire(p, pold, new) try_cmpxchg(p, pold, new)
      |                                                       ^
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:52:21: note: expanded from macro 'try_cmpxchg'
   52 |                 __unqual_typeof(*(p)) __r = cmpxchg(p, __o, new); \
      |                                   ^
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:38:20: note: expanded from macro '__unqual_typeof'
   38 |                 default: (typeof(x))0))
      |                                  ^
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:77:39: note: expanded from macro 'likely'
   77 | #define likely(x) __builtin_expect(!!(x), 1)
      |                                       ^
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:210:16: error: member reference base type '__attribute__((address_space(1))) u32' (aka '__attribute__((address_space(1))) unsigned int') is not a structure or union 210 |         return likely(atomic_try_cmpxchg_acquire(&lock->val, &val, _Q_LOCKED_VAL));
      | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:138:26: note: expanded from macro 'atomic_try_cmpxchg_acquire'
  138 |         try_cmpxchg_acquire(&(p)->counter, pold, new)
      |                                 ^ ~~~~~~~
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:60:55: note: expanded from macro 'try_cmpxchg_acquire'
   60 | #define try_cmpxchg_acquire(p, pold, new) try_cmpxchg(p, pold, new)
      |                                                       ^
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:52:39: note: expanded from macro 'try_cmpxchg'
   52 |                 __unqual_typeof(*(p)) __r = cmpxchg(p, __o, new); \
      |                                                     ^
/root/bpf-next/tools/testing/selftests/bpf/bpf_atomic.h:47:59: note: expanded from macro 'cmpxchg'
   47 | #define cmpxchg(p, old, new) __sync_val_compare_and_swap((p), old, new)
      | ^
/root/bpf-next/tools/testing/selftests/bpf/bpf_arena_spin_lock.h:77:39: note: expanded from macro 'likely'
   77 | #define likely(x) __builtin_expect(!!(x), 1)
      |                                       ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Makefile:731: /root/bpf-next/tools/testing/selftests/bpf/arena_spin_lock.bpf.o] Error 1

If you happen to fix the issue, please add below tag.

Regards,

Venkat.

#1 lore raw
Quoted 12 lines · Venkat Rao Bagalkote

Greetings!!!

selftests/bpf fails to compile with below error on bpf-next repo with commit head: f28214603dc6c09b3b5e67b1ebd5ca83ad943ce3

Repo link:
https://web.git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/

Reverting below commit resolves the issue.

Commit ID: 48b3be8d7f82bea6affe6b9f11ee67380b55ede8

...

Quoted 3 lines

If you happen to fix the issue, please add below tag.

Not quite. The issue is likely that your llvm is too old. Please upgrade.

#2 lore raw
Quoted 12 lines · Alexei Starovoitov
Quoted 10 lines · Venkat Rao Bagalkote

Greetings!!!

selftests/bpf fails to compile with below error on bpf-next repo with commit head: f28214603dc6c09b3b5e67b1ebd5ca83ad943ce3

Repo link:
https://web.git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/

Reverting below commit resolves the issue.

Quoted 8 lines
Quoted 1 line

Commit ID: 48b3be8d7f82bea6affe6b9f11ee67380b55ede8

...

Quoted 3 lines

If you happen to fix the issue, please add below tag.

Not quite. The issue is likely that your llvm is too old. Please upgrade.

Thanks for the feedback.

I did try the compilation on fedora41, with linux-mainline kernel and /sefltests/bpf compiled successfully. But on the same set-up /selftests/bpf failed to compile on bpf-next kernel.

OS: Fedora Linux 41 (Server Edition)
LLVM: llvm-19.1.7-3.fc41.ppc64le

gcc version 14.2.1 20250110 (Red Hat 14.2.1-7) (GCC)

Passing repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Failing repo: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/

Regards,

Venkat.

Quoted 1 line
#3 lore raw
Quoted 27 lines · Venkat Rao Bagalkote
Quoted 12 lines · Alexei Starovoitov
Quoted 10 lines · Venkat Rao Bagalkote

Greetings!!!

selftests/bpf fails to compile with below error on bpf-next repo with commit head: f28214603dc6c09b3b5e67b1ebd5ca83ad943ce3

Repo link:
https://web.git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/

Reverting below commit resolves the issue.

Quoted 8 lines
Quoted 1 line

Commit ID: 48b3be8d7f82bea6affe6b9f11ee67380b55ede8

...

Quoted 3 lines

If you happen to fix the issue, please add below tag.

Not quite. The issue is likely that your llvm is too old. Please upgrade.

Thanks for the feedback.

Quoted 7 lines

I did try the compilation on fedora41, with linux-mainline kernel and /sefltests/bpf compiled successfully. But on the same set-up /selftests/bpf failed to compile on bpf-next kernel.

OS: Fedora Linux 41 (Server Edition)
LLVM: llvm-19.1.7-3.fc41.ppc64le

After staring at the error log in disbelief, I guess I have the answer.
https://elixir.bootlin.com/linux/v6.13.6/source/arch/powerpc/include/asm/qspinlock_types.h#L8

PowerPC overrides the type such that lock->val is no longer atomic_t. All of the bpf_atomic.h helpers assume it's atomic_t, hence they try to do lock->val.counter which obviously fails with val is u32 instead of a struct.

The "fix" would probably be to replace the usage of struct qspinlock with our own definition copying the asm-generic qspinlock type.

I can send a patch later today in the evening, unless you beat me to it.

Thanks

Quoted 13 lines

gcc version 14.2.1 20250110 (Red Hat 14.2.1-7) (GCC)

Passing repo:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Failing repo:
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/

Regards,

Venkat.

Quoted 1 line