diff options
author | Ilya Leoshkevich <iii@linux.ibm.com> | 2025-04-24 19:41:27 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2025-04-25 03:24:28 +0300 |
commit | be5521991506552c0873371694e4a2cb263e1b9c (patch) | |
tree | 0a7466d55f2d52038c38535dd44a8a6b1f44df98 /tools/testing/selftests/bpf/progs | |
parent | 0240e5a9431cb48f980fd44f913d7f0886b0aded (diff) | |
download | linux-be5521991506552c0873371694e4a2cb263e1b9c.tar.xz |
selftests/bpf: Fix endianness issue in __qspinlock declaration
Copy the big-endian field declarations from qspinlock_types.h,
otherwise some properties won't hold on big-endian systems. For
example, assigning lock->val = 1 should result in lock->locked == 1,
which is not the case there.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Link: https://lore.kernel.org/r/20250424165525.154403-4-iii@linux.ibm.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs')
-rw-r--r-- | tools/testing/selftests/bpf/progs/bpf_arena_spin_lock.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/bpf_arena_spin_lock.h b/tools/testing/selftests/bpf/progs/bpf_arena_spin_lock.h index 4e29c31c4ef8..d67466c1ff77 100644 --- a/tools/testing/selftests/bpf/progs/bpf_arena_spin_lock.h +++ b/tools/testing/selftests/bpf/progs/bpf_arena_spin_lock.h @@ -32,6 +32,7 @@ extern unsigned long CONFIG_NR_CPUS __kconfig; struct __qspinlock { union { atomic_t val; +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ struct { u8 locked; u8 pending; @@ -40,6 +41,17 @@ struct __qspinlock { u16 locked_pending; u16 tail; }; +#else + struct { + u16 tail; + u16 locked_pending; + }; + struct { + u8 reserved[2]; + u8 pending; + u8 locked; + }; +#endif }; }; |