Re: [PATCH v2 09/15] tools/rv: Copy stripped bpf_atomic.h from libarena

From: Gabriele Monaco

Date: Thu Oct 08 2026 - 05:05:08 EST




Il 7 ottobre 2026 12:59:46 UTC, Nam Cao <namcao@xxxxxxxxxxxxx> ha scritto:
>Gabriele Monaco <gmonaco@xxxxxxxxxx> writes:
>> Add bpf_atomic.h including atomic read/write macros like READ_ONCE() and
>> try_cmpxchg(). This version is a stripped down copy of the one currently
>> present in selftests/bpf/libarena.
>
>Instead of this, what do you think about using C11's atomic stuffs? I
>prefer standardized stuff when it is an option.

Mmh, I'm not too familiar with them, but they wouldn't be drop-in replacements as far as I understand. I'd need to use C11 atomic types and that would diverge further from the kernel implementation.

Ideally I wouldn't like to copy libarena's implementation but I couldn't find a cleaner way to include it.

I'm going to look into that more carefully though.

Thanks,
Gabriele