Re: [PATCH bpf-next v5 5/9] selftests/bpf: Add basic libarena scaffolding

Emil Tsalapatis
2026-04-10T20:12:18Z

On Fri Apr 10, 2026 at 3:44 PM EDT, Kumar Kartikeya Dwivedi wrote:
> On Fri, 10 Apr 2026 at 20:39, Song Liu <song@kernel.org> wrote:
>>
>> On Fri, Apr 10, 2026 at 9:31 AM Emil Tsalapatis <emil@etsalapatis.com> wrote:
>> [...]
>> > diff --git a/tools/testing/selftests/bpf/libarena/include/common.h b/tools/testing/selftests/bpf/libarena/include/common.h
>> > new file mode 100644
>> > index 000000000000..5acf9b994943
>> > --- /dev/null
>> > +++ b/tools/testing/selftests/bpf/libarena/include/common.h
>> > @@ -0,0 +1,67 @@
>> > +// SPDX-License-Identifier: LGPL-2.1 OR BSD-2-Clause
>> > +/* Copyright (c) 2026 Meta Platforms, Inc. and affiliates. */
>> > +#pragma once
>> > +
>> > +#ifdef __BPF__
>> > +
>> > +#include <vmlinux.h>
>> > +
>> > +#include "bpf_experimental.h"
>>
>> bpf_experimental.h is not needed here.
>>
>> > +#include "bpf_arena_common.h"
>> > +#include "bpf_arena_spin_lock.h"
>>
>> These two headers are indeed needed. However, what's the plan
>> with them? They are not part of libarena at the moment. How should
>> we include them in the future?
>
> I would propose making them part of libarena, and adding libarena's
> header directory to -I for all progs in selftest to simplify
> inclusion.
>

+1 on this. We should have all arena related functionality in a single
directory.

>>
>> Thanks,
>> Song
>>
>> > +#include <asm-generic/errno.h>
>> > +
>> > +#ifndef __BPF_FEATURE_ADDR_SPACE_CAST
>> > +#error "Arena allocators require bpf_addr_space_cast feature"
>> > +#endif
>> > +
>> …