[PATCH bpf-next v2 8/9] selftests/bpf: Add selftests for load-acquire and store-release instructions
Peilin Ye
yepeilin at google.com
Tue Feb 11 11:09:52 PST 2025
On Mon, Feb 10, 2025 at 04:08:44PM -0800, Eduard Zingerman wrote:
> > +++ b/tools/testing/selftests/bpf/progs/verifier_load_acquire.c
> > @@ -0,0 +1,190 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +
> > +#include <linux/bpf.h>
> > +#include <bpf/bpf_helpers.h>
> > +#include "../../../include/linux/filter.h"
> > +#include "bpf_misc.h"
> > +
> > +#if defined(ENABLE_ATOMICS_TESTS) && defined(__TARGET_ARCH_arm64)
>
> [...]
>
> > +#else
> > +
> > +SEC("socket")
> > +__description("load-acquire is not supported by compiler or jit, use a dummy test")
> > +__success
> > +int dummy_test(void)
> > +{
> > + return 0;
> > +}
>
> Nit: why is dummy_test() necessary?
It's just to make it clear when these tests are (effectively) skipped.
Otherwise, e.g. -cpuv4 runner with LLVM-18 on x86-64 would give:
#518 verifier_load_acquire:OK
With dummy_test(), we would see:
(FWIW, for v3 I'm planning to change __description() to the following,
since new tests no longer depend on __BPF_FEATURE_LOAD_ACQ_STORE_REL.)
#518/1 verifier_load_acquire/Clang version < 18, or JIT does not support load-acquire; use a dummy test:OK
#518 verifier_load_acquire:OK
Commit 147c8f4470ee ("selftests/bpf: Add unit tests for new
sign-extension load insns") did similar thing in verifier_ldsx.c.
> > +
> > +#endif
> > +
> > +char _license[] SEC("license") = "GPL";
>
> [...]
Thanks,
Peilin Ye
More information about the linux-arm-kernel
mailing list