[bpf-next v2] bpf: drop deprecated bpf_jit_enable == 2
Christophe Leroy
christophe.leroy at csgroup.eu
Tue Jan 17 06:55:53 PST 2023
Le 17/01/2023 à 15:41, Quentin Monnet a écrit :
> [Vous ne recevez pas souvent de courriers de quentin at isovalent.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
>
> 2023-01-17 14:25 UTC+0000 ~ Christophe Leroy <christophe.leroy at csgroup.eu>
>>
>>
>> Le 17/01/2023 à 15:18, Tonghao Zhang a écrit :
>>>
>>>
>>>> On Jan 17, 2023, at 7:36 PM, Christophe Leroy <christophe.leroy at csgroup.eu> wrote:
>>>>
>>>>
>>>>
>>>> Le 17/01/2023 à 08:30, Christophe Leroy a écrit :
>>>>>
>>>>>
>>>>> Le 17/01/2023 à 06:30, Tonghao Zhang a écrit :
>>>>>>
>>>>>>
>>>>>>> On Jan 9, 2023, at 4:15 PM, Christophe Leroy
>>>>>>> <christophe.leroy at csgroup.eu> wrote:
>
> [...]
>
>>>>>>> Sure I will try to test bpftool again in the coming days.
>>>>>>>
>>>>>>> Previous discussion about that subject is here:
>>>>>>> https://patchwork.kernel.org/project/linux-riscv/patch/20210415093250.3391257-1-Jianlin.Lv@arm.com/#24176847=
>
> Christophe, apologies from dropping the discussion the last time, it
> seems your last message on that thread didn't make it to my inbox at the
> time :/. Thanks a lot for looking into that again!
>
>>>>>> Hi Christophe
>>>>>> Any progress? We discuss to deprecate the bpf_jit_enable == 2 in 2021,
>>>>>> but bpftool can not run on powerpc.
>>>>>> Now can we fix this issue?
>>>>>
>>>>> Hi Tong,
>>>>>
>>>>> I have started to look at it but I don't have any fruitfull feedback yet.
>>>>
>>>> Hi Again,
>>>>
>>>> I tested again, the problem is still the same as one year ago:
>>>>
>>>> root at vgoip:~# ./bpftool prog
>>>> libbpf: elf: endianness mismatch in pid_iter_bpf.
>>> It seem to be not right ehdr->e_ident[EI_DATA]. Do we can print the real value?
>>> /*
>>> * e_ident[EI_DATA]
>>> */
>>> #define ELFDATANONE 0
>>> #define ELFDATA2LSB 1
>>> #define ELFDATA2MSB 2
>>> #define ELFDATANUM 3
>>>
>>> bpf_object__elf_init:
>>> obj->efile.ehdr = ehdr = elf64_getehdr(elf);
>>>
>>>> libbpf: failed to initialize skeleton BPF object 'pid_iter_bpf': -4003
>>>> Error: failed to open PID iterator skeleton
>>>>
>>>> root at vgoip:~# uname -a
>>>> Linux vgoip 6.2.0-rc3-02596-g1c2c9c13e256 #242 PREEMPT Tue Jan 17
>>>> 09:36:08 CET 2023 ppc GNU/Linux
>>> On my pc, elf is little endian.
>>> # readelf -h tools/bpf/bpftool/pid_iter.bpf.o
>>> ELF Header:
>>> Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
>>> Class: ELF64
>>> Data: 2's complement, little endian # x86_64
>>> Version: 1 (current)
>>> OS/ABI: UNIX - System V
>>> ABI Version: 0
>>> Type: REL (Relocatable file)
>>> Machine: Linux BPF
>>> Version: 0x1
>>> Entry point address: 0x0
>>> Start of program headers: 0 (bytes into file)
>>> Start of section headers: 64832 (bytes into file)
>>> Flags: 0x0
>>> Size of this header: 64 (bytes)
>>> Size of program headers: 0 (bytes)
>>> Number of program headers: 0
>>> Size of section headers: 64 (bytes)
>>> Number of section headers: 13
>>> Section header string table index: 1
>>>
>>
>> Yes, must be something wrong with the build, I get same as you :
>>
>> $ LANG= readelf -h pid_iter.bpf.o
>> ELF Header:
>> Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
>> Class: ELF64
>> Data: 2's complement, little endian
>> Version: 1 (current)
>> OS/ABI: UNIX - System V
>> ABI Version: 0
>> Type: REL (Relocatable file)
>> Machine: Linux BPF
>> Version: 0x1
>> Entry point address: 0x0
>> Start of program headers: 0 (bytes into file)
>> Start of section headers: 34704 (bytes into file)
>> Flags: 0x0
>> Size of this header: 64 (bytes)
>> Size of program headers: 0 (bytes)
>> Number of program headers: 0
>> Size of section headers: 64 (bytes)
>> Number of section headers: 13
>> Section header string table index: 1
>>
>>
>> Whereas I expect the same as bpftool I suppose, which is :
>>
>> $ LANG= readelf -h bpftool
>> ELF Header:
>> Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
>> Class: ELF32
>> Data: 2's complement, big endian
>> Version: 1 (current)
>> OS/ABI: UNIX - System V
>> ABI Version: 0
>> Type: EXEC (Executable file)
>> Machine: PowerPC
>> Version: 0x1
>> Entry point address: 0x100027d0
>> Start of program headers: 52 (bytes into file)
>> Start of section headers: 1842896 (bytes into file)
>> Flags: 0x0
>> Size of this header: 52 (bytes)
>> Size of program headers: 32 (bytes)
>> Number of program headers: 9
>> Size of section headers: 40 (bytes)
>> Number of section headers: 39
>> Section header string table index: 38
>>
>
> pid_iter.bpf.o should be generated from that command in bpftool's Makefile:
>
> $(OUTPUT)%.bpf.o: skeleton/%.bpf.c $(OUTPUT)vmlinux.h \
> $(LIBBPF_BOOTSTRAP)
> $(QUIET_CLANG)$(CLANG) \
> -I$(or $(OUTPUT),.) \
> -I$(srctree)/tools/include/uapi/ \
> -I$(LIBBPF_BOOTSTRAP_INCLUDE) \
> -g -O2 -Wall -fno-stack-protector \
> -target bpf -c $< -o $@
>
> My understanding is that "-target bpf" is supposed to pick the
> endianness for the host (see "llc --version | grep bpf". If that's not
> the case, could you please try to turn that into '-target bpfeb' in the
> Makefile instead? I'd be curious to see if it helps.
>
I guess it cannot work if it picks the endianness for the build host. It
should pick the endianness for the target host.
That's worse it seems with bpfeb : it fails at build :
LINK /home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/bpftool
GEN vmlinux.h
CLANG pid_iter.bpf.o
GEN pid_iter.skel.h
libbpf: elf: endianness mismatch in pid_iter_bpf.
Error: failed to open BPF object file: Endian mismatch
make: *** [Makefile:222: pid_iter.skel.h] Error 93
Complete build in case it helps:
$ LANG= make CROSS_COMPILE=ppc-linux- ARCH=powerpc
Auto-detecting system features:
... clang-bpf-co-re: [ [32mon[m ]
... llvm: [ [31mOFF[m ]
... libcap: [ [31mOFF[m ]
... libbfd: [ [31mOFF[m ]
MKDIR /home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/
make[1]: Entering directory '/home/chleroy/linux-powerpc/tools/lib/bpf'
GEN
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/bpf_helper_defs.h
MKDIR /home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/libbpf.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/bpf.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/nlattr.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/btf.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/libbpf_errno.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/str_error.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/netlink.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/bpf_prog_linfo.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/libbpf_probes.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/hashmap.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/btf_dump.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/ringbuf.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/strset.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/linker.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/gen_loader.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/relo_core.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/usdt.o
LD
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/staticobjs/libbpf-in.o
LINK /home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/libbpf.a
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/include/bpf/bpf.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/include/bpf/libbpf.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/include/bpf/btf.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/include/bpf/libbpf_common.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/include/bpf/libbpf_legacy.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/include/bpf/bpf_helpers.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/include/bpf/bpf_tracing.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/include/bpf/bpf_endian.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/include/bpf/bpf_core_read.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/include/bpf/skel_internal.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/include/bpf/libbpf_version.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/include/bpf/usdt.bpf.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/include/bpf/bpf_helper_defs.h
INSTALL libbpf_headers
make[1]: Leaving directory '/home/chleroy/linux-powerpc/tools/lib/bpf'
MKDIR /home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/include/bpf
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/include/bpf/hashmap.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/include/bpf/nlattr.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/include/bpf/relo_core.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/libbpf/include/bpf/libbpf_internal.h
CC btf.o
CC btf_dumper.o
CC cfg.o
CC cgroup.o
CC common.o
CC feature.o
CC gen.o
CC iter.o
CC json_writer.o
CC link.o
CC main.o
CC map.o
CC map_perf_ring.o
CC net.o
CC netlink_dumper.o
CC perf.o
MKDIR
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/include/bpf
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/hashmap.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/relo_core.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/libbpf_internal.h
MKDIR /home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/
MKDIR /home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/
make[1]: Entering directory '/home/chleroy/linux-powerpc/tools/lib/bpf'
GEN
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/bpf_helper_defs.h
MKDIR
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/libbpf.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/bpf.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/nlattr.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/btf.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/libbpf_errno.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/str_error.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/netlink.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/bpf_prog_linfo.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/libbpf_probes.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/hashmap.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/btf_dump.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/ringbuf.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/strset.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/linker.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/gen_loader.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/relo_core.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/usdt.o
LD
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/staticobjs/libbpf-in.o
LINK
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/libbpf.a
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/libbpf.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/btf.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/libbpf_common.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/libbpf_legacy.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_helpers.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_tracing.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_endian.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_core_read.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/skel_internal.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/libbpf_version.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/usdt.bpf.h
INSTALL
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_helper_defs.h
INSTALL libbpf_headers
make[1]: Leaving directory '/home/chleroy/linux-powerpc/tools/lib/bpf'
CC /home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/main.o
CC /home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/common.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/json_writer.o
CC /home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/gen.o
CC /home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/btf.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/xlated_dumper.o
CC
/home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/btf_dumper.o
CC /home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/disasm.o
LINK /home/chleroy/linux-powerpc/tools/bpf/bpftool/bootstrap/bpftool
GEN vmlinux.h
CLANG pid_iter.bpf.o
GEN pid_iter.skel.h
libbpf: elf: endianness mismatch in pid_iter_bpf.
Error: failed to open BPF object file: Endian mismatch
make: *** [Makefile:222: pid_iter.skel.h] Error 93
More information about the linux-riscv
mailing list