All of lore.kernel.org
 help / color / mirror / Atom feed
* [bpf-next] selftests/bpf fails to compile
@ 2025-03-10  7:31 Venkat Rao Bagalkote
  2025-03-10  8:45 ` Alexei Starovoitov
  0 siblings, 1 reply; 4+ messages in thread
From: Venkat Rao Bagalkote @ 2025-03-10  7:31 UTC (permalink / raw)
  To: bpf, linux-kernel, Hari Bathini, Saket Kumar Bhaskar, ast, memxor

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@linux.ibm.com>


Regards,

Venkat.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bpf-next] selftests/bpf fails to compile
  2025-03-10  7:31 [bpf-next] selftests/bpf fails to compile Venkat Rao Bagalkote
@ 2025-03-10  8:45 ` Alexei Starovoitov
  2025-03-11 14:12   ` Venkat Rao Bagalkote
  0 siblings, 1 reply; 4+ messages in thread
From: Alexei Starovoitov @ 2025-03-10  8:45 UTC (permalink / raw)
  To: Venkat Rao Bagalkote
  Cc: bpf, LKML, Hari Bathini, Saket Kumar Bhaskar, Alexei Starovoitov,
	Kumar Kartikeya Dwivedi

On Mon, Mar 10, 2025 at 8:32 AM Venkat Rao Bagalkote
<venkat88@linux.ibm.com> wrote:
>
> 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

...

> If you happen to fix the issue, please add below tag.
>
> Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bpf-next] selftests/bpf fails to compile
  2025-03-10  8:45 ` Alexei Starovoitov
@ 2025-03-11 14:12   ` Venkat Rao Bagalkote
  2025-03-11 14:40     ` Kumar Kartikeya Dwivedi
  0 siblings, 1 reply; 4+ messages in thread
From: Venkat Rao Bagalkote @ 2025-03-11 14:12 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: bpf, LKML, Hari Bathini, Saket Kumar Bhaskar, Alexei Starovoitov,
	Kumar Kartikeya Dwivedi


On 10/03/25 2:15 pm, Alexei Starovoitov wrote:
> On Mon, Mar 10, 2025 at 8:32 AM Venkat Rao Bagalkote
> <venkat88@linux.ibm.com> wrote:
>> 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
> ...
>
>> If you happen to fix the issue, please add below tag.
>>
>> Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> 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.

>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bpf-next] selftests/bpf fails to compile
  2025-03-11 14:12   ` Venkat Rao Bagalkote
@ 2025-03-11 14:40     ` Kumar Kartikeya Dwivedi
  0 siblings, 0 replies; 4+ messages in thread
From: Kumar Kartikeya Dwivedi @ 2025-03-11 14:40 UTC (permalink / raw)
  To: Venkat Rao Bagalkote
  Cc: Alexei Starovoitov, bpf, LKML, Hari Bathini, Saket Kumar Bhaskar,
	Alexei Starovoitov

On Tue, 11 Mar 2025 at 15:12, Venkat Rao Bagalkote
<venkat88@linux.ibm.com> wrote:
>
>
> On 10/03/25 2:15 pm, Alexei Starovoitov wrote:
> > On Mon, Mar 10, 2025 at 8:32 AM Venkat Rao Bagalkote
> > <venkat88@linux.ibm.com> wrote:
> >> 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
> > ...
> >
> >> If you happen to fix the issue, please add below tag.
> >>
> >> Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> > 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

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


>
> 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.
>
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-11 14:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-10  7:31 [bpf-next] selftests/bpf fails to compile Venkat Rao Bagalkote
2025-03-10  8:45 ` Alexei Starovoitov
2025-03-11 14:12   ` Venkat Rao Bagalkote
2025-03-11 14:40     ` Kumar Kartikeya Dwivedi

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.