[PATCH bpf-next 0/2] BPF kselftest cross-build/RISC-V fixes

Björn Töpel posted 2 patches 2 years, 7 months ago
tools/testing/selftests/bpf/Makefile                  | 4 ++++
tools/testing/selftests/bpf/verifier/atomic_cmpxchg.c | 1 +
tools/testing/selftests/bpf/verifier/ctx_skb.c        | 2 ++
tools/testing/selftests/bpf/verifier/jmp32.c          | 8 ++++++++
tools/testing/selftests/bpf/verifier/map_kptr.c       | 2 ++
tools/testing/selftests/bpf/verifier/precise.c        | 2 +-
6 files changed, 18 insertions(+), 1 deletion(-)
[PATCH bpf-next 0/2] BPF kselftest cross-build/RISC-V fixes
Posted by Björn Töpel 2 years, 7 months ago
From: Björn Töpel <bjorn@rivosinc.com>

This series has two minor fixes, found when cross-compiling for the
RISC-V architecture.

Some RISC-V systems do not define HAVE_EFFICIENT_UNALIGNED_ACCESS,
which made some of tests bail out. Fix the failing tests by adding
F_NEEDS_EFFICIENT_UNALIGNED_ACCESS.

...and some RISC-V systems *do* define
HAVE_EFFICIENT_UNALIGNED_ACCESS. In this case the autoconf.h was not
correctly picked up by the build system.


Cheers,
Björn

Björn Töpel (2):
  selftests/bpf: Add F_NEEDS_EFFICIENT_UNALIGNED_ACCESS to some tests
  selftests/bpf: Honor $(O) when figuring out paths

 tools/testing/selftests/bpf/Makefile                  | 4 ++++
 tools/testing/selftests/bpf/verifier/atomic_cmpxchg.c | 1 +
 tools/testing/selftests/bpf/verifier/ctx_skb.c        | 2 ++
 tools/testing/selftests/bpf/verifier/jmp32.c          | 8 ++++++++
 tools/testing/selftests/bpf/verifier/map_kptr.c       | 2 ++
 tools/testing/selftests/bpf/verifier/precise.c        | 2 +-
 6 files changed, 18 insertions(+), 1 deletion(-)


base-commit: a94098d490e17d652770f2309fcb9b46bc4cf864
-- 
2.39.2

Re: [PATCH bpf-next 0/2] BPF kselftest cross-build/RISC-V fixes
Posted by Daniel Borkmann 2 years, 7 months ago
On 7/5/23 1:39 PM, Björn Töpel wrote:
> From: Björn Töpel <bjorn@rivosinc.com>
> 
> This series has two minor fixes, found when cross-compiling for the
> RISC-V architecture.
> 
> Some RISC-V systems do not define HAVE_EFFICIENT_UNALIGNED_ACCESS,
> which made some of tests bail out. Fix the failing tests by adding
> F_NEEDS_EFFICIENT_UNALIGNED_ACCESS.
> 
> ...and some RISC-V systems *do* define
> HAVE_EFFICIENT_UNALIGNED_ACCESS. In this case the autoconf.h was not
> correctly picked up by the build system.

Looks good, applied thanks! Any plans on working towards integrating riscv
into upstream BPF CI? Would love to see that happening. :)

Thanks,
Daniel
Re: [PATCH bpf-next 0/2] BPF kselftest cross-build/RISC-V fixes
Posted by Björn Töpel 2 years, 7 months ago
Daniel Borkmann <daniel@iogearbox.net> writes:

> On 7/5/23 1:39 PM, Björn Töpel wrote:
>> From: Björn Töpel <bjorn@rivosinc.com>
>> 
>> This series has two minor fixes, found when cross-compiling for the
>> RISC-V architecture.
>> 
>> Some RISC-V systems do not define HAVE_EFFICIENT_UNALIGNED_ACCESS,
>> which made some of tests bail out. Fix the failing tests by adding
>> F_NEEDS_EFFICIENT_UNALIGNED_ACCESS.
>> 
>> ...and some RISC-V systems *do* define
>> HAVE_EFFICIENT_UNALIGNED_ACCESS. In this case the autoconf.h was not
>> correctly picked up by the build system.
>
> Looks good, applied thanks! 

Thank you!

> Any plans on working towards integrating riscv into upstream BPF CI?
> Would love to see that happening. :)

Yes! I started hacking a bit on that some time back:

  https://github.com/libbpf/ci/pull/87
  https://github.com/kernel-patches/vmtest/pull/194

(TL;DR: I'll continuing that work at some point.)

RISC-V still needs cross-compilation, and testing on qemu/TCG (on
typically x86-hosts), which puts some constraints on the
rootfs/cross-compilation host; For RISC-V Debian Bullseye is way too old
(a lot packages are missing/broken). Typically for BPF it would be
Ubuntu Kinetic (or later), or some Debian Sid snapshot.

The rootfs, the host, and the host foreign arch would need to be the
same for "no-hassle cross-compilation on Debian derivatives" -- and at
least younger than "Ubuntu Kinetic"-age.

AFAIU, there are some issues with rootfs version and build host
versioning for other archs as well: https://github.com/libbpf/ci/pull/83


Björn