[bpf-next] selftests/bpf fails to compile
From: Venkat Rao Bagalkote
Date: Mon Mar 10 2025 - 03:32:14 EST
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.
Reported-by: Venkat Rao Bagalkote <venkat88@xxxxxxxxxxxxx>
Regards,
Venkat.