[PATCH bpf-next v4 4/8] libbpf: Support BTF.ext loading and output in either endianness

2024-08-30 Thread Tony Ambardar
btf_ext__endianness() and btf_ext__set_endianness() for query and setting byte-order, as already exist for BTF data. [1] 3289959b97ca ("libbpf: Support BTF loading and raw data output in both endianness") [2] 8fd27bf69b86 ("libbpf: Add BPF static linker BTF and BTF.ext support") Signed-o

[PATCH bpf-next v4 5/8] libbpf: Support opening bpf objects of either endianness

2024-08-30 Thread Tony Ambardar
Allow bpf_object__open() to access files of either endianness, and convert included BPF programs to native byte-order in-memory for introspection. Loading BPF objects of non-native byte-order is still disallowed however. Signed-off-by: Tony Ambardar --- tools/lib/bpf/libbpf.c | 49

Re: [PATCH bpf-next v4 3/8] libbpf: Fix output .symtab byte-order during linking

2024-08-31 Thread Tony Ambardar
On Fri, Aug 30, 2024 at 03:15:10PM -0700, Eduard Zingerman wrote: > On Fri, 2024-08-30 at 00:29 -0700, Tony Ambardar wrote: > > Object linking output data uses the default ELF_T_BYTE type for '.symtab' > > section data, which disables any libelf-based translation. Explici

Re: [PATCH bpf-next v4 7/8] libbpf: Support creating light skeleton of either endianness

2024-08-31 Thread Tony Ambardar
On Fri, Aug 30, 2024 at 06:24:47PM -0700, Alexei Starovoitov wrote: > On Fri, Aug 30, 2024 at 2:31 PM Andrii Nakryiko > wrote: > > > > > > > > for the rest, Alexei, can you please review and give your ack? > > It looks fine. > All of the additional pr_debug()s look a bit excessive. > Will take an

Re: [PATCH bpf-next v4 5/8] libbpf: Support opening bpf objects of either endianness

2024-08-31 Thread Tony Ambardar
On Fri, Aug 30, 2024 at 02:25:54PM -0700, Andrii Nakryiko wrote: > On Fri, Aug 30, 2024 at 12:30 AM Tony Ambardar > wrote: > > > > Allow bpf_object__open() to access files of either endianness, and convert > > included BPF programs to native byte-order in-memory for in

Re: [PATCH bpf-next v4 5/8] libbpf: Support opening bpf objects of either endianness

2024-08-31 Thread Tony Ambardar
On Fri, Aug 30, 2024 at 06:16:25PM -0700, Eduard Zingerman wrote: > On Fri, 2024-08-30 at 00:29 -0700, Tony Ambardar wrote: > > [...] > > > @@ -940,6 +942,21 @@ bpf_object__add_programs(struct bpf_object *obj, > > Elf_Data *sec_data, > > return 0;

Re: [PATCH bpf-next v4 7/8] libbpf: Support creating light skeleton of either endianness

2024-08-31 Thread Tony Ambardar
On Fri, Aug 30, 2024 at 02:30:46PM -0700, Andrii Nakryiko wrote: > On Fri, Aug 30, 2024 at 12:30 AM Tony Ambardar > wrote: > > > > Track target endianness in 'struct bpf_gen' and process in-memory data in > > native byte-order, but on finalization convert th

Re: [PATCH bpf-next v4 5/8] libbpf: Support opening bpf objects of either endianness

2024-08-31 Thread Tony Ambardar
On Fri, Aug 30, 2024 at 06:26:10PM -0700, Eduard Zingerman wrote: > On Fri, 2024-08-30 at 14:25 -0700, Andrii Nakryiko wrote: > > [...] > > > > err = bpf_object__elf_init(obj); > > > - err = err ? : bpf_object__check_endianness(obj); > > > err = err ? : bpf_object__elf_colle

Re: [PATCH bpf-next v4 6/8] libbpf: Support linking bpf objects of either endianness

2024-08-31 Thread Tony Ambardar
On Fri, Aug 30, 2024 at 02:25:07PM -0700, Andrii Nakryiko wrote: > On Fri, Aug 30, 2024 at 12:30 AM Tony Ambardar > wrote: > > > > Allow static linking object files of either endianness, checking that input > > files have consistent byte-order, and setting outp

Re: [PATCH bpf-next v4 4/8] libbpf: Support BTF.ext loading and output in either endianness

2024-09-02 Thread Tony Ambardar
On Fri, Aug 30, 2024 at 02:14:19PM -0700, Andrii Nakryiko wrote: > On Fri, Aug 30, 2024 at 12:30 AM Tony Ambardar > wrote: > > > > Support for handling BTF data of either endianness was added in [1], but > > did not include BTF.ext data for lack of use cases. Later

[PATCH bpf-next v5 0/8] libbpf, selftests/bpf: Support cross-endian usage

2024-09-03 Thread Tony Ambardar
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

[PATCH bpf-next v5 1/8] libbpf: Improve log message formatting

2024-09-03 Thread Tony Ambardar
Fix missing newlines and extraneous terminal spaces in messages. Signed-off-by: Tony Ambardar --- tools/lib/bpf/btf.c | 6 +++--- tools/lib/bpf/btf_dump.c | 2 +- tools/lib/bpf/btf_relocate.c | 2 +- tools/lib/bpf/libbpf.c | 4 ++-- tools/lib/bpf/relo_core.c| 2 +- 5

[PATCH bpf-next v5 2/8] libbpf: Fix header comment typos for BTF.ext

2024-09-03 Thread Tony Ambardar
Mention struct btf_ext_info_sec rather than non-existent btf_sec_func_info in BTF.ext struct documentation. Signed-off-by: Tony Ambardar --- tools/lib/bpf/libbpf_internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf

[PATCH bpf-next v5 3/8] libbpf: Fix output .symtab byte-order during linking

2024-09-03 Thread Tony Ambardar
rectly translated. Fixes: faf6ed321cf6 ("libbpf: Add BPF static linker APIs") Signed-off-by: Tony Ambardar --- tools/lib/bpf/linker.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/lib/bpf/linker.c b/tools/lib/bpf/linker.c index 9cd3d4109788..7489306cd6f7 100644 --- a/tools/l

[PATCH bpf-next v5 4/8] libbpf: Support BTF.ext loading and output in either endianness

2024-09-03 Thread Tony Ambardar
btf_ext__endianness() and btf_ext__set_endianness() for query and setting byte-order, as already exist for BTF data. [1] 3289959b97ca ("libbpf: Support BTF loading and raw data output in both endianness") [2] 8fd27bf69b86 ("libbpf: Add BPF static linker BTF and BTF.ext support") Signed-o

[PATCH bpf-next v5 5/8] libbpf: Support opening bpf objects of either endianness

2024-09-03 Thread Tony Ambardar
Allow bpf_object__open() to access files of either endianness, and convert included BPF programs to native byte-order in-memory for introspection. Loading BPF objects of non-native byte-order is still disallowed however. Signed-off-by: Tony Ambardar --- tools/lib/bpf/libbpf.c | 52

[PATCH bpf-next v5 6/8] libbpf: Support linking bpf objects of either endianness

2024-09-03 Thread Tony Ambardar
. This is enabled by built-in ELF translation and recent BTF/BTF.ext endianness functions. Further add local functions for swapping byte-order of sections containing BPF insns. Signed-off-by: Tony Ambardar --- tools/lib/bpf/linker.c | 78 +- 1 file changed

[PATCH bpf-next v5 7/8] libbpf: Support creating light skeleton of either endianness

2024-09-03 Thread Tony Ambardar
to target byte-order on finalization. Add support functions to convert data to target endianness as it is added to the blob. Also add additional debug logging for data blob structure details and skeleton loading. Signed-off-by: Tony Ambardar --- tools/lib/bpf/bpf_gen_internal.h | 1 + too

[PATCH bpf-next v5 8/8] selftests/bpf: Support cross-endian building

2024-09-03 Thread Tony Ambardar
Update Makefile build rules to compile BPF programs with target endianness rather than host byte-order. With recent changes, this allows building the full selftests/bpf suite hosted on x86_64 and targeting s390x or mips64eb for example. Signed-off-by: Tony Ambardar --- tools/testing/selftests

Re: [PATCH bpf-next v5 7/8] libbpf: Support creating light skeleton of either endianness

2024-09-03 Thread Tony Ambardar
On Tue, Sep 03, 2024 at 12:57:51PM -0700, Alexei Starovoitov wrote: > On Tue, Sep 3, 2024 at 12:34 AM Tony Ambardar wrote: > > > > @@ -1040,10 +1121,11 @@ void bpf_gen__map_update_elem(struct bpf_gen *gen, > > int map_idx, void *pvalue, > > int zero = 0; >

Re: [PATCH bpf-next v4 4/8] libbpf: Support BTF.ext loading and output in either endianness

2024-09-16 Thread Tony Ambardar
On Fri, Aug 30, 2024 at 05:15:06PM -0700, Eduard Zingerman wrote: > On Fri, 2024-08-30 at 00:29 -0700, Tony Ambardar wrote: > > [...] > > > @@ -3050,11 +3127,42 @@ static int btf_ext_parse_hdr(__u8 *data, __u32 > > data_size) > > return -ENOTS

Re: [PATCH bpf-next v5 4/8] libbpf: Support BTF.ext loading and output in either endianness

2024-09-16 Thread Tony Ambardar
On Wed, Sep 04, 2024 at 12:48:36PM -0700, Andrii Nakryiko wrote: > On Tue, Sep 3, 2024 at 12:33 AM Tony Ambardar wrote: > > > > Support for handling BTF data of either endianness was added in [1], but > > did not include BTF.ext data for lack of use cases. Later, support for

[PATCH bpf-next v6 0/8] libbpf, selftests/bpf: Support cross-endian usage

2024-09-16 Thread Tony Ambardar
s 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 heade

[PATCH bpf-next v6 1/8] libbpf: Improve log message formatting

2024-09-16 Thread Tony Ambardar
Fix missing newlines and extraneous terminal spaces in messages. Signed-off-by: Tony Ambardar --- tools/lib/bpf/btf.c | 6 +++--- tools/lib/bpf/btf_dump.c | 2 +- tools/lib/bpf/btf_relocate.c | 2 +- tools/lib/bpf/libbpf.c | 4 ++-- tools/lib/bpf/relo_core.c| 2 +- 5

[PATCH bpf-next v6 2/8] libbpf: Fix header comment typos for BTF.ext

2024-09-16 Thread Tony Ambardar
Mention struct btf_ext_info_sec rather than non-existent btf_sec_func_info in BTF.ext struct documentation. Signed-off-by: Tony Ambardar --- tools/lib/bpf/libbpf_internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf

[PATCH bpf-next v6 3/8] libbpf: Fix output .symtab byte-order during linking

2024-09-16 Thread Tony Ambardar
rectly translated. Fixes: faf6ed321cf6 ("libbpf: Add BPF static linker APIs") Signed-off-by: Tony Ambardar --- tools/lib/bpf/linker.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/lib/bpf/linker.c b/tools/lib/bpf/linker.c index e0005c6ade88..6985ab0f1ca9 100644 --- a/tools/l

[PATCH bpf-next v6 4/8] libbpf: Support BTF.ext loading and output in either endianness

2024-09-16 Thread Tony Ambardar
btf_ext__endianness() and btf_ext__set_endianness() for query and setting byte-order, as already exist for BTF data. [1] 3289959b97ca ("libbpf: Support BTF loading and raw data output in both endianness") [2] 8fd27bf69b86 ("libbpf: Add BPF static linker BTF and BTF.ext support") Signed-o

[PATCH bpf-next v6 5/8] libbpf: Support opening bpf objects of either endianness

2024-09-16 Thread Tony Ambardar
Allow bpf_object__open() to access files of either endianness, and convert included BPF programs to native byte-order in-memory for introspection. Loading BPF objects of non-native byte-order is still disallowed however. Signed-off-by: Tony Ambardar --- tools/lib/bpf/libbpf.c | 51

[PATCH bpf-next v6 6/8] libbpf: Support linking bpf objects of either endianness

2024-09-16 Thread Tony Ambardar
. This is enabled by built-in ELF translation and recent BTF/BTF.ext endianness functions. Further add local functions for swapping byte-order of sections containing BPF insns. Signed-off-by: Tony Ambardar --- tools/lib/bpf/linker.c | 78 +- 1 file changed

[PATCH bpf-next v6 7/8] libbpf: Support creating light skeleton of either endianness

2024-09-16 Thread Tony Ambardar
to target byte-order on finalization. Add support functions to convert data to target endianness as it is added to the blob. Also add additional debug logging for data blob structure details and skeleton loading. Acked-by: Alexei Starovoitov Signed-off-by: Tony Ambardar --- too

[PATCH bpf-next v6 8/8] selftests/bpf: Support cross-endian building

2024-09-16 Thread Tony Ambardar
Update Makefile build rules to compile BPF programs with target endianness rather than host byte-order. With recent changes, this allows building the full selftests/bpf suite hosted on x86_64 and targeting s390x or mips64eb for example. Acked-by: Yonghong Song Signed-off-by: Tony Ambardar

[PATCH bpf v1] selftests/bpf: Fix cross-compiling urandom_read

2024-10-08 Thread Tony Ambardar
LD), passed via '-fuse-ld=' using an absolute path rather than a linker "flavour". Fixes: 08c79c9cd67f ("selftests/bpf: Don't force lld on non-x86 architectures") Signed-off-by: Tony Ambardar --- tools/testing/selftests/bpf/Makefile | 2 +- 1 file change

[PATCH bpf v1] selftests/bpf: Fix error compiling cgroup_ancestor.c with musl libc

2024-10-08 Thread Tony Ambardar
ument to allow compiling for both musl and glibc. Cc: Alexis Lothoré (eBPF Foundation) Fixes: f957c230e173 ("selftests/bpf: convert test_skb_cgroup_id_user to test_progs") Signed-off-by: Tony Ambardar --- tools/testing/selftests/bpf/prog_tests/cgroup_ancestor.c | 2 +- 1 file changed,

[PATCH bpf-next v1 0/3] Improve .BTF_ids patching and alignment

2024-09-20 Thread Tony Ambardar
data is 4-byte aligned, and not only the .BTF_ids used for vmlinux. Patch #3 syncs the above changes in btf_ids.h to tools/include, obviating a previous alignment fix in selftests/bpf. Feedback and suggestions are welcome! Best regards, Tony Tony Ambardar (3): tools/resolve_btfids: Simplify

[PATCH bpf-next v1 1/3] tools/resolve_btfids: Simplify handling cross-endian compilation

2024-09-20 Thread Tony Ambardar
ot;) CC: Viktor Malik Signed-off-by: Tony Ambardar --- tools/bpf/resolve_btfids/main.c | 60 - 1 file changed, 22 insertions(+), 38 deletions(-) diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c index d54aaa0619df..9f1ab23ed014 100644

[PATCH bpf-next v1 2/3] bpf: btf: Ensure natural alignment of .BTF_ids section

2024-09-20 Thread Tony Ambardar
encoding macros in btf_ids.h to always align BTF ID data to 4 bytes. [1]: 3effc06a4dde ("selftests/bpf: Fix alignment of .BTF_ids") Signed-off-by: Tony Ambardar --- include/linux/btf_ids.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/btf_ids.h b/include/linux/btf_i

[PATCH bpf-next v1 3/3] tools/bpf, selftests/bpf : Sync btf_ids.h to tools

2024-09-20 Thread Tony Ambardar
Update to include latest changes, including BTF_SET8 support and correct alignment of .BTF_ids sections, and remove the now-redundant alignment fix introduced in 3effc06a4dde ("selftests/bpf: Fix alignment of .BTF_ids"). CC: Jean-Philippe Brucker Signed-off-by: Tony Ambardar --- too

[PATCH bpf v1] selftests/bpf: Fix runqslower cross-endian build

2025-01-24 Thread Tony Ambardar
From: Tony Ambardar The runqslower binary from a cross-endian build currently fails to run because the included skeleton has host endianness. Fix this by passing the target BPF endianness to the runqslower sub-make. Fixes: 5a63c33d6f00 ("selftests/bpf: Support cross-endian building")

<    1   2