> diff --git a/tools/testing/selftests/bpf/libarena/include/libarena/bitmap.h b/tools/testing/selftests/bpf/libarena/include/libarena/bitmap.h
> index 8c5936ae9958..163e2b83d943 100644
> --- a/tools/testing/selftests/bpf/libarena/include/libarena/bitmap.h
> +++ b/tools/testing/selftests/bpf/libarena/include/libarena/bitmap.h
> @@ -1,6 +1,8 @@
> // SPDX-License-Identifier: LGPL-2.1 OR BSD-2-Clause
> #pragma once
>
> +#include <bpf_atomic.h>
> +
Does this break host-includability? The other libarena headers (common.h,
buddy.h, asan.h) deliberately keep themselves dual-use: common.h has an
explicit #else /* ! __BPF__ */ arm that defines __arena to nothing, and
buddy.h/asan.h fence their function declarations behind #ifdef __BPF__
while leaving structs visible.
Including bpf_atomic.h unconditionally pulls in vmlinux.h and
bpf/bpf_helpers.h:
tools/testing/selftests/bpf/bpf_atomic.h:
#include <vmlinux.h>
#include <bpf/bpf_helpers.h>
#include <bpf_may_goto.h>
extern bool CONFIG_X86_64 __kconfig __weak;
None of that is usable from a host compile. The Makefile adds both
-I$(CURDIR)/libarena/include and -I$(INCLUDE_DIR) (where vmlinux.h lives)
to COMMON_CFLAGS, so a host TU that includes bitmap.h would pull vmlinux.h
into a build that also has libc/uapi headers, under -Wall -Werror.
No host TU currently includes bitmap.h, so this is latent rather than
breaking the build right now, but it silently removes a property the
neighboring headers maintain.
The include is also redundant: all three existing consumers (bitmap.bpf.c,
test_bitmap.bpf.c, test_parallel_bitmap.bpf.c) already include
libarena/common.h, which pulls bpf_atomic.h indirectly via
bpf_arena_spin_lock.h at line 8. And it doesn't make the header
self-contained anyway - bitmap.h still relies on the includer for __arena,
u64, size_t, and bool.
Would #include <libarena/common.h>, or wrapping the new include and the
three inline bodies in #ifdef __BPF__ the way buddy.h does, keep the
dual-use property intact?
[ ... ]
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/32062809860
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.