NIKSS-vSwitch / nikss

Native In-Kernel P4-programmable Software Switch for Software-Defined Networking (previously PSA-eBPF)
Apache License 2.0
47 stars 4 forks source link

NIKSS unable to load #101

Closed g83wang closed 1 year ago

g83wang commented 1 year ago

Hello, I built the https://github.com/p4lang/p4c/blob/main/backends/ebpf/psa/examples/upf.p4 and am trying to load the out.o file with nikss-ctl pipeline load id 0 out.o, which gives me the following error messages:

libbpf: elf: skipping unrecognized data section(9) .maps.clone_session_tbl_inner libbpf: elf: skipping unrecognized data section(10) .maps.clone_session_tbl libbpf: elf: skipping unrecognized data section(11) .maps.multicast_grp_tbl_inner libbpf: elf: skipping unrecognized data section(12) .maps.multicast_grp_tbl libbpf: elf: skipping unrecognized data section(13) .maps.ingress_ip_forward_ipv4_lpm libbpf: elf: skipping unrecognized data section(14) .maps.ingress_ip_forward_ipv4_lpm_defaultAction libbpf: elf: skipping unrecognized data section(15) .maps.ingress_upf_ingress_far_lookup libbpf: elf: skipping unrecognized data section(16) .maps.ingress_upf_ingress_far_lookup_defaultAction libbpf: elf: skipping unrecognized data section(17) .maps.ingress_upf_ingress_pdr_lookup_prefixes libbpf: elf: skipping unrecognized data section(18) .maps.ingress_upf_ingress_pdr_lookup_tuple libbpf: elf: skipping unrecognized data section(19) .maps.ingress_upf_ingress_pdr_lookup_tuples_map libbpf: elf: skipping unrecognized data section(20) .maps.ingress_upf_ingress_pdr_lookup_defaultAction libbpf: elf: skipping unrecognized data section(21) .maps.ingress_upf_ingress_session_lookup_by_teid libbpf: elf: skipping unrecognized data section(22) .maps.ingress_upf_ingress_session_lookup_by_teid_defaultAction libbpf: elf: skipping unrecognized data section(23) .maps.ingress_upf_ingress_session_lookup_by_ue_ip libbpf: elf: skipping unrecognized data section(24) .maps.ingress_upf_ingress_session_lookup_by_ue_ip_defaultAction libbpf: elf: skipping unrecognized data section(25) .maps.ingress_upf_ingress_source_interface_lookup_by_port libbpf: elf: skipping unrecognized data section(26) .maps.ingress_upf_ingress_source_interface_lookup_by_port_defaultAction libbpf: elf: skipping unrecognized data section(27) .maps.ingress_upf_process_ingress_l4port_ingress_l4_dst_port libbpf: elf: skipping unrecognized data section(28) .maps.ingress_upf_process_ingress_l4port_ingress_l4_dst_port_defaultAction libbpf: elf: skipping unrecognized data section(29) .maps.ingress_upf_process_ingress_l4port_ingress_l4_src_port libbpf: elf: skipping unrecognized data section(30) .maps.ingress_upf_process_ingress_l4port_ingress_l4_src_port_defaultAction libbpf: elf: skipping unrecognized data section(31) .maps.ingress_upf_process_ingress_l4port_ingress_l4port_fields libbpf: elf: skipping unrecognized data section(32) .maps.ingress_upf_process_ingress_l4port_ingress_l4port_fields_defaultAction libbpf: elf: skipping unrecognized data section(33) .maps.hdr_md_cpumap libbpf: elf: skipping unrecognized data section(34) .maps.crc_lookup_tbl libbpf: elf: skipping unrecognized data section(35) .rodata.cst32 libbpf: elf: skipping unrecognized data section(37) .rodata.cst16 libbpf: elf: skipping unrecognized data section(51) .eh_frame libbpf: elf: skipping relo section(52) .rel.eh_frame for section(51) .eh_frame libbpf: maps section in out.o: "clone_session_tbl" has unrecognized, non-zero options cannot load the BPF program: No such file or directory An error occurred during pipeline load id 0

The file out.o is in the current directory and it has correct permissions. Could I get some ideas about what is going wrong here?

Thank you.

tatry commented 1 year ago

Hello, thanks for your issue.

To help to reproduce the problem, could you provide following information:

  1. Operating system you use (name and version).
  2. Kernel and clang version (alternatively you can provide output from command nikss-ctl validate-os if you use latest version).
g83wang commented 1 year ago

Hello, thanks for your issue.

To help to reproduce the problem, could you provide following information:

  1. Operating system you use (name and version).
  2. Kernel and clang version (alternatively you can provide output from command nikss-ctl validate-os if you use latest version).

Thanks for the reply.

  1. I am using Ubuntu 20.04
  2. The kernel version is 5.14.0-1054-oem and the clang version is clang version 10.0.0-4ubuntu
tatry commented 1 year ago

I've just run that kernel on my Ubuntu 20.04 machine and I didn't experience the problem with loading.

How do you compile the P4 code?

g83wang commented 1 year ago

I've just run that kernel on my Ubuntu 20.04 machine and I didn't experience the problem with loading.

How do you compile the P4 code?

Thank you so much for your reply.

Sorry, my fault. I compiled it in the wrong directory so that the relative path backends/... in the clang command does not make sense to clang. After I fixed the path, it is all good. And I can load it now.

But I got the following when I load: $ sudo nikss-ctl pipeline load id 0 out.o

libbpf: elf: skipping unrecognized data section(8) .maps.clone_session_tbl_inner libbpf: elf: skipping unrecognized data section(9) .maps.clone_session_tbl libbpf: elf: skipping unrecognized data section(10) .maps.multicast_grp_tbl_inner libbpf: elf: skipping unrecognized data section(11) .maps.multicast_grp_tbl libbpf: elf: skipping unrecognized data section(12) .maps.ingress_ip_forward_ipv4_lpm libbpf: elf: skipping unrecognized data section(13) .maps.ingress_ip_forward_ipv4_lpm_defaultAction libbpf: elf: skipping unrecognized data section(14) .maps.ingress_upf_ingress_far_lookup libbpf: elf: skipping unrecognized data section(15) .maps.ingress_upf_ingress_far_lookup_defaultAction libbpf: elf: skipping unrecognized data section(16) .maps.ingress_upf_ingress_pdr_lookup_prefixes libbpf: elf: skipping unrecognized data section(17) .maps.ingress_upf_ingress_pdr_lookup_tuple libbpf: elf: skipping unrecognized data section(18) .maps.ingress_upf_ingress_pdr_lookup_tuples_map libbpf: elf: skipping unrecognized data section(19) .maps.ingress_upf_ingress_pdr_lookup_defaultAction libbpf: elf: skipping unrecognized data section(20) .maps.ingress_upf_ingress_session_lookup_by_teid libbpf: elf: skipping unrecognized data section(21) .maps.ingress_upf_ingress_session_lookup_by_teid_defaultAction libbpf: elf: skipping unrecognized data section(22) .maps.ingress_upf_ingress_session_lookup_by_ue_ip libbpf: elf: skipping unrecognized data section(23) .maps.ingress_upf_ingress_session_lookup_by_ue_ip_defaultAction libbpf: elf: skipping unrecognized data section(24) .maps.ingress_upf_ingress_source_interface_lookup_by_port libbpf: elf: skipping unrecognized data section(25) .maps.ingress_upf_ingress_source_interface_lookup_by_port_defaultAction libbpf: elf: skipping unrecognized data section(26) .maps.ingress_upf_process_ingress_l4port_ingress_l4_dst_port libbpf: elf: skipping unrecognized data section(27) .maps.ingress_upf_process_ingress_l4port_ingress_l4_dst_port_defaultAction libbpf: elf: skipping unrecognized data section(28) .maps.ingress_upf_process_ingress_l4port_ingress_l4_src_port libbpf: elf: skipping unrecognized data section(29) .maps.ingress_upf_process_ingress_l4port_ingress_l4_src_port_defaultAction libbpf: elf: skipping unrecognized data section(30) .maps.ingress_upf_process_ingress_l4port_ingress_l4port_fields libbpf: elf: skipping unrecognized data section(31) .maps.ingress_upf_process_ingress_l4port_ingress_l4port_fields_defaultAction libbpf: elf: skipping unrecognized data section(32) .maps.hdr_md_cpumap libbpf: elf: skipping unrecognized data section(33) .maps.crc_lookup_tbl libbpf: elf: skipping unrecognized data section(34) .rodata.cst32 libbpf: elf: skipping unrecognized data section(37) .rodata.cst16 libbpf: elf: skipping unrecognized data section(51) .eh_frame libbpf: elf: skipping relo section(52) .rel.eh_frame for section(51) .eh_frame libbpf: Error in bpf_create_map_xattr(multicast_grp_tbl):ERROR: strerror_r(-524)=22(-524). Retrying without BTF. libbpf: Error in bpf_create_map_xattr(clone_session_tbl):ERROR: strerror_r(-524)=22(-524). Retrying without BTF. libbpf: Error in bpf_create_map_xattr(ingress_upf_ingress_pdr_lookup_tuples_map):ERROR: strerror_r(-524)=22(-524). Retrying without BTF. Pipeline id 0 successfully loaded!

I am wondering what the errors at the end mean: we were retrying and then succeeded?

Thank you.

tatry commented 1 year ago

libbpf: Error in bpf_create_map_xattr(multicast_grp_tbl):ERROR: strerror_r(-524)=22(-524). Retrying without BTF. libbpf: Error in bpf_create_map_xattr(clone_session_tbl):ERROR: strerror_r(-524)=22(-524). Retrying without BTF. libbpf: Error in bpf_create_map_xattr(ingress_upf_ingress_pdr_lookup_tuples_map):ERROR: strerror_r(-524)=22(-524). Retrying without BTF. Pipeline id 0 successfully loaded!

I am wondering what the errors at the end mean: we were retrying and then succeeded?

I would say that these errors are somehow expected. P4C builds each ebpf map with BTF metadata (applicable only for PSA architecture), but some map types (here: map in map used for ternary matching, clone sessions and multicast groups) do not support BTF metadata. In such case libbpf retries to load that map again but without BTF metadata, resulting in this confusing message.

In other words: these error messages actually are not errors.

g83wang commented 1 year ago

Oh, I see. Thank you.