Re: [PATCH] selftests: Do not skip BPF selftests by default
From: Björn Töpel
Date: Fri Oct 04 2024 - 09:34:59 EST
Mark!
Mark Brown <broonie@xxxxxxxxxx> writes:
> On Fri, Oct 04, 2024 at 11:53:47AM +0200, Björn Töpel wrote:
>> From: Björn Töpel <bjorn@xxxxxxxxxxxx>
>>
>> This effectively is a revert of commit 7a6eb7c34a78 ("selftests: Skip
>> BPF seftests by default"). At the time when this was added, BPF had
>> "build time dependencies on cutting edge versions". Since then a
>> number of BPF capable tests has been included in net, hid, sched_ext.
>>
>> There is no reason not to include BPF by default in the build.
>
> The issue was always requiring a bleeding edge version of clang, not
> sure if that's been relaxed yet, IIRC sometimes it required git
> versions. I have clang 20 installed here so that's not an issue for me
> but given that that's not released yet it wouldn't be reasonable to
> expect CI systems to install it.
Yeah, but I'd say that is not the case anymore. LLVM 18 and 19 works.
> There's a few other substantial issues with all of these suites now I
> look, none of them build on arm64 since arm64 defconfig has
> DEBUG_INFO_REDUCED=y which isn't compatible with CONFIG_DEBUG_INFO_BTF
> so that gets turned off and the build splats trying to read the BTF out
> of the kernel binary (which is a new build dep for the selftests
> too...).
>
> https://storage.kernelci.org/next/master/next-20241004/arm64/defconfig%2Bkselftest/gcc-12/config/
>
> We also get a bunch of:
>
> die__process_unit: DW_TAG_label (0xa) @ <0x58eb7> not handled!
> die__process_unit: tag not supported 0xa (label)!
>
> if we do turn enable CONFIG_DEBUG_INFO_BTF for arm64.
This is pahole version related.
> The whole thing is also broken for cross compilation with clang since
> everything is assuming that CROSS_COMPILE will be set for cross builds
> but that's not the case for LLVM=1 builds - net gives:
>
> BPF_PROG nat6to4.bpf.o
> BPF_PROG sample_map_ret0.bpf.o
> /usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-gnu/bin/ld: /home/broonie/git/linux/tools/testing/selftests/net/libynl.a(ynl.o): Relocations in generic ELF (EM: 62)
> /usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-gnu/bin/ld: /home/broonie/git/linux/tools/testing/selftests/net/libynl.a(ynl.o): Relocations in generic ELF (EM: 62)
> /usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-gnu/bin/ld: /home/broonie/git/linux/tools/testing/selftests/net/libynl.a(ynl.o): Relocations in generic ELF (EM: 62)
> /usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-gnu/bin/ld: /home/broonie/git/linux/tools/testing/selftests/net/libynl.a: error adding symbols: file in wrong format
> BPF_PROG sample_ret0.bpf.o
> collect2: error: ld returned 1 exit status
>
> with similar errors in libbpf for HID:
>
> /usr/bin/aarch64-linux-gnu-ld: /home/broonie/git/linux/tools/testing/selftests/hid/tools/build/libbpf/libbpf.a(libbpf-in.o): Relocations in generic ELF (EM: 62)
> /usr/bin/aarch64-linux-gnu-ld: /home/broonie/git/linux/tools/testing/selftests/hid/tools/build/libbpf/libbpf.a(libbpf-in.o): Relocations in generic ELF (EM: 62)
>
> KernelCI is seeing failures earlier with HID:
>
> https://storage.kernelci.org/next/master/next-20241004/arm64/defconfig%2Bkselftest/gcc-12/logs/kselftest.log
>
> and an unrelated missing dependency on libssl for net that needs to be
> fixed.
A lot can be said about kselftest, and cross-building. It's a bit of a
mess. Maybe we should move to meson or something for kselftest (that
requires less work for lazy developers like me). ;-)
I'm simply arguing that the *default* should be: BPF (and
hid/net/sched_ext) turned on. Default on would surface these kind of
problems, rather than hiding them. (And let the CI exclude tests it
cannot handle).
Cheers!
Björn