Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH bpf-next v2 0/8] libbpf, selftests/bpf: Support cross-endian usage
@ 2024-08-22  9:24 Tony Ambardar
  2024-08-22  9:24 ` [PATCH bpf-next v2 1/8] libbpf: Improve log message formatting Tony Ambardar
                   ` (7 more replies)
  0 siblings, 8 replies; 23+ messages in thread
From: Tony Ambardar @ 2024-08-22  9:24 UTC (permalink / raw)
  To: bpf
  Cc: Tony Ambardar, linux-kselftest, Andrii Nakryiko, Eduard Zingerman,
	Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
	Hao Luo, Jiri Olsa, Mykola Lysenko, Shuah Khan, Ilya Leoshkevich,
	Quentin Monnet

From: Tony Ambardar <tony.ambardar@gmail.com>

Hello all,

This patch series targets a long-standing BPF usability issue - the lack
of general cross-compilation support - by enabling cross-endian usage of
libbpf and bpftool, as well as supporting cross-endian build targets for
selftests/bpf.

Benefits include improved BPF development and testing for embedded systems
based on e.g. big-endian MIPS, more build options e.g for s390x systems,
and better accessibility to the very latest test tools e.g. 'test_progs'.

Initial development and testing used mips64, since this arch makes
switching the build byte-order trivial and is thus very handy for A/B
testing. However, it lacks some key features (bpf2bpf call, kfuncs, etc)
making for poor selftests/bpf coverage.

Final testing takes the kernel and selftests/bpf cross-built from x86_64
to s390x, and runs the result under QEMU/s390x. That same configuration
could also be used on kernel-patches/bpf CI for regression testing endian
support or perhaps load-sharing s390x builds across x86_64 systems.

This thread includes some background regarding testing on QEMU/s390x and
the generally favourable results:
    https://lore.kernel.org/bpf/ZsEcsaa3juxxQBUf@kodidev-ubuntu/

Feedback and suggestions are welcome!

Best regards,
Tony


Changelog:
---------
v1 -> v2:
 - fixed a light skeleton bug causing test_progs 'map_ptr' failure
 - simplified some BTF.ext related endianness logic
 - remove an 'inline' usage related to CI checkpatch failure
 - improve some formatting noted by checkpatch warnings
 - unexpected 'test_progs' failures drop 3 -> 2 (x86_64 to s390x cross)



Tony Ambardar (8):
  libbpf: Improve log message formatting
  libbpf: Fix header comment typos for BTF.ext
  libbpf: Fix output .symtab byte-order during linking
  libbpf: Support BTF.ext loading and output in either endianness
  libbpf: Support opening bpf objects of either endianness
  libbpf: Support linking bpf objects of either endianness
  libbpf: Support creating light skeleton of either endianness
  selftests/bpf: Support cross-endian building

 tools/lib/bpf/bpf_gen_internal.h     |   1 +
 tools/lib/bpf/btf.c                  | 168 ++++++++++++++++++++++--
 tools/lib/bpf/btf.h                  |   3 +
 tools/lib/bpf/btf_dump.c             |   2 +-
 tools/lib/bpf/btf_relocate.c         |   2 +-
 tools/lib/bpf/gen_loader.c           | 187 ++++++++++++++++++++-------
 tools/lib/bpf/libbpf.c               |  26 +++-
 tools/lib/bpf/libbpf.map             |   2 +
 tools/lib/bpf/libbpf_internal.h      |  17 ++-
 tools/lib/bpf/linker.c               | 108 +++++++++++++---
 tools/lib/bpf/relo_core.c            |   2 +-
 tools/lib/bpf/skel_internal.h        |   3 +-
 tools/testing/selftests/bpf/Makefile |   7 +-
 13 files changed, 444 insertions(+), 84 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2024-08-27  8:42 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-22  9:24 [PATCH bpf-next v2 0/8] libbpf, selftests/bpf: Support cross-endian usage Tony Ambardar
2024-08-22  9:24 ` [PATCH bpf-next v2 1/8] libbpf: Improve log message formatting Tony Ambardar
2024-08-22 23:36   ` Andrii Nakryiko
2024-08-26 10:51     ` Tony Ambardar
2024-08-22  9:24 ` [PATCH bpf-next v2 2/8] libbpf: Fix header comment typos for BTF.ext Tony Ambardar
2024-08-22  9:24 ` [PATCH bpf-next v2 3/8] libbpf: Fix output .symtab byte-order during linking Tony Ambardar
2024-08-22  9:24 ` [PATCH bpf-next v2 4/8] libbpf: Support BTF.ext loading and output in either endianness Tony Ambardar
2024-08-22 23:36   ` Andrii Nakryiko
2024-08-23 19:47     ` Andrii Nakryiko
2024-08-22  9:24 ` [PATCH bpf-next v2 5/8] libbpf: Support opening bpf objects of " Tony Ambardar
2024-08-23 19:47   ` Andrii Nakryiko
2024-08-26 10:53     ` Tony Ambardar
2024-08-26 21:28       ` Andrii Nakryiko
2024-08-27  8:40         ` Tony Ambardar
2024-08-22  9:24 ` [PATCH bpf-next v2 6/8] libbpf: Support linking " Tony Ambardar
2024-08-23 19:47   ` Andrii Nakryiko
2024-08-26 10:56     ` Tony Ambardar
2024-08-22  9:24 ` [PATCH bpf-next v2 7/8] libbpf: Support creating light skeleton " Tony Ambardar
2024-08-23 19:47   ` Andrii Nakryiko
2024-08-26 10:58     ` Tony Ambardar
2024-08-26 21:25       ` Andrii Nakryiko
2024-08-27  8:42         ` Tony Ambardar
2024-08-22  9:24 ` [PATCH bpf-next v2 8/8] selftests/bpf: Support cross-endian building Tony Ambardar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox