On Tue, Nov 26, 2024 at 09:32:28AM -0800, Eduard Zingerman wrote: > On Tue, 2024-11-26 at 13:25 -0300, Arnaldo Carvalho de Melo wrote: > [...] > Hi Arnaldo, > > I think I saw instructions in one of the messages in this thread to get > > hold of a vmlinux for s390 and test it. Right? > Yes, in cover letter. Full vmlinux is not needed, a vmlinux binary for > s390 would be sufficient for testing. Repeating the recipe for convenience: > To reproduce the bug: > - follow the instructions in [0] to build an s390 vmlinux; > - generate BTF requesting declaration tags for kfuncs: > $ pahole --btf_features_strict=decl_tag_kfuncs,decl_tag \ > --btf_encode_detached=test.btf vmlinux > - observe that no kfuncs are generated: > $ bpftool btf dump file test.btf format c | grep __ksym > [0] https://docs.kernel.org/bpf/s390.html Thanks. > > One extra question: this solves the BTF encoder case, the loader already > > supported loading BTF from a different endianness, right? Lemme > > check. > > cus__load_btf() > > cu->little_endian = btf__endianness(btf) == BTF_LITTLE_ENDIAN; > > enum btf_endianness btf__endianness(const struct btf *btf) > > { > > if (is_host_big_endian()) > > return btf->swapped_endian ? BTF_LITTLE_ENDIAN : BTF_BIG_ENDIAN; > > else > > return btf->swapped_endian ? BTF_BIG_ENDIAN : BTF_LITTLE_ENDIAN; > > } > I can switch to is_host_big_endian() instead of `BYTE_ORDER` macro > if you think that's better. No need for that, I think, is_host_big_endian() is a static function inlib/bpf/src/btf.c. I was just looking at how endianness was being handled and noticed libbpf does it, but, as you say below... > > So we have parts of BTF byte swapping happening in libbpf and with this > > patch, parts of it done in pahole, have you tought about doing this in > > libbpf instead? > BTF id lists handling is currently not a part of libbpf. So we should do it in pahole, as you did, so all is clarified now, I'm now testing it with the provided instructions. Thanks, - Arnaldo