From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from www62.your-server.de ([213.133.104.62]:33517 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932576AbeCMLQj (ORCPT ); Tue, 13 Mar 2018 07:16:39 -0400 Subject: Re: question about bpf.test_progs.fail To: lst , Alexei Starovoitov , netdev@vger.kernel.org References: <8a680f9e-93c2-8a71-ba8b-1d4a874cfe8f@cn.fujitsu.com> From: Daniel Borkmann Message-ID: <959f6f70-142f-0070-83fc-ee484856c1db@iogearbox.net> Date: Tue, 13 Mar 2018 12:16:34 +0100 MIME-Version: 1.0 In-Reply-To: <8a680f9e-93c2-8a71-ba8b-1d4a874cfe8f@cn.fujitsu.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org List-ID: Hi Shaoting, On 03/12/2018 02:52 AM, lst wrote: > hi, I have a question need your help. > > I get failure "libbpf: incorrect bpf_call opcode" when running below two cases on v4.16-rc3: > --------------------- > test_l4lb_all(); >     const char *file2 = "./test_l4lb_noinline.o"; > > test_xdp_noinline(); > --------------------- > > and from the file test_libbpf.sh, it seems libbpf can't load noinline functions. > --------------------- > # TODO: fix libbpf to load noinline functions > # [warning] libbpf: incorrect bpf_call opcode > #libbpf_open_file test_l4lb_noinline.o > --------------------- > > They all point to bpf_object__open(filename) at last. > Here(test_progs) test "test_l4lb_noinline.o" but test_libbpf.sh don't. > > So, I guess there must be some setting (like certain kernel kconfig or compiling) to make the test work. > > Can you tell me how can I make this test(test_progs) pass? Are you using/linking against an old libbpf version that doesn't support BPF to BPF calls? Latest works fine for me: # clang --version clang version 7.0.0 (http://llvm.org/git/clang.git 491b0d6736475fbb9509877edcc18051272b30bd) (http://llvm.org/git/llvm.git 4b957aaea877317bd77344eaa8d8a6645fbaf822) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/local/bin # llc --version LLVM (http://llvm.org/): LLVM version 7.0.0svn Optimized build. Default target: x86_64-unknown-linux-gnu Host CPU: skylake Registered Targets: bpf - BPF (host endian) bpfeb - BPF (big endian) bpfel - BPF (little endian) # uname -a Linux linux.home 4.16.0-rc4+ #48 SMP Mon Mar 12 15:22:34 CET 2018 x86_64 x86_64 x86_64 GNU/Linux # cd tools/testing/selftests/bpf # make clean > /dev/null # make > /dev/null Warning: Kernel ABI header at 'tools/include/uapi/linux/bpf.h' differs from latest version at 'include/uapi/linux/bpf.h' Warning: Kernel ABI header at 'tools/include/uapi/linux/if_link.h' differs from latest version at 'include/uapi/linux/if_link.h' # ./test_progs test_pkt_access:PASS:ipv4 148 nsec test_pkt_access:PASS:ipv6 122 nsec test_xdp:PASS:ipv4 6898 nsec test_xdp:PASS:ipv6 15287 nsec test_l4lb:PASS:ipv4 1126 nsec test_l4lb:PASS:ipv6 1824 nsec test_l4lb:PASS:ipv4 1754 nsec test_l4lb:PASS:ipv6 3254 nsec test_xdp_noinline:PASS:ipv4 2620 nsec test_xdp_noinline:PASS:ipv6 3994 nsec test_tcp_estats:PASS: 0 nsec test_bpf_obj_id:PASS:get-fd-by-notexist-prog-id 0 nsec test_bpf_obj_id:PASS:get-fd-by-notexist-map-id 0 nsec test_bpf_obj_id:PASS:get-map-info(fd) 0 nsec test_bpf_obj_id:PASS:get-prog-info(fd) 0 nsec test_bpf_obj_id:PASS:get-map-info(fd) 0 nsec test_bpf_obj_id:PASS:get-prog-info(fd) 0 nsec test_bpf_obj_id:PASS:get-prog-fd(next_id) 0 nsec test_bpf_obj_id:PASS:get-prog-fd(next_id) 0 nsec test_bpf_obj_id:PASS:get-prog-fd-bad-nr-map-ids 0 nsec test_bpf_obj_id:PASS:get-prog-info(next_id->fd) 0 nsec test_bpf_obj_id:PASS:get-prog-fd(next_id) 0 nsec test_bpf_obj_id:PASS:get-prog-fd-bad-nr-map-ids 0 nsec test_bpf_obj_id:PASS:get-prog-info(next_id->fd) 0 nsec test_bpf_obj_id:PASS:check total prog id found by get_next_id 0 nsec test_bpf_obj_id:PASS:get-map-fd(next_id) 0 nsec test_bpf_obj_id:PASS:get-map-fd(next_id) 0 nsec test_bpf_obj_id:PASS:get-map-fd(next_id) 0 nsec test_bpf_obj_id:PASS:get-map-fd(next_id) 0 nsec test_bpf_obj_id:PASS:get-map-fd(next_id) 0 nsec test_bpf_obj_id:PASS:get-map-fd(next_id) 0 nsec test_bpf_obj_id:PASS:get-map-fd(next_id) 0 nsec test_bpf_obj_id:PASS:get-map-fd(next_id) 0 nsec test_bpf_obj_id:PASS:get-map-fd(next_id) 0 nsec test_bpf_obj_id:PASS:check get-map-info(next_id->fd) 0 nsec test_bpf_obj_id:PASS:get-map-fd(next_id) 0 nsec test_bpf_obj_id:PASS:check get-map-info(next_id->fd) 0 nsec test_bpf_obj_id:PASS:check total map id found by get_next_id 0 nsec test_pkt_md_access:PASS: 263 nsec test_obj_name:PASS:check-bpf-prog-name 0 nsec test_obj_name:PASS:check-bpf-map-name 0 nsec test_obj_name:PASS:check-bpf-prog-name 0 nsec test_obj_name:PASS:check-bpf-map-name 0 nsec test_obj_name:PASS:check-bpf-prog-name 0 nsec test_obj_name:PASS:check-bpf-map-name 0 nsec test_obj_name:PASS:check-bpf-prog-name 0 nsec test_obj_name:PASS:check-bpf-map-name 0 nsec test_tp_attach_query:PASS:open 0 nsec test_tp_attach_query:PASS:read 0 nsec test_tp_attach_query:PASS:prog_load 0 nsec test_tp_attach_query:PASS:bpf_obj_get_info_by_fd 0 nsec test_tp_attach_query:PASS:perf_event_open 0 nsec test_tp_attach_query:PASS:perf_event_ioc_enable 0 nsec test_tp_attach_query:PASS:perf_event_ioc_query_bpf 0 nsec test_tp_attach_query:PASS:perf_event_ioc_set_bpf 0 nsec test_tp_attach_query:PASS:perf_event_ioc_query_bpf 0 nsec test_tp_attach_query:PASS:perf_event_ioc_query_bpf 0 nsec test_tp_attach_query:PASS:prog_load 0 nsec test_tp_attach_query:PASS:bpf_obj_get_info_by_fd 0 nsec test_tp_attach_query:PASS:perf_event_open 0 nsec test_tp_attach_query:PASS:perf_event_ioc_enable 0 nsec test_tp_attach_query:PASS:perf_event_ioc_set_bpf 0 nsec test_tp_attach_query:PASS:perf_event_ioc_query_bpf 0 nsec test_tp_attach_query:PASS:perf_event_ioc_query_bpf 0 nsec test_tp_attach_query:PASS:perf_event_ioc_query_bpf 0 nsec test_tp_attach_query:PASS:perf_event_ioc_query_bpf 0 nsec test_tp_attach_query:PASS:perf_event_ioc_query_bpf 0 nsec test_tp_attach_query:PASS:perf_event_ioc_query_bpf 0 nsec test_tp_attach_query:PASS:prog_load 0 nsec test_tp_attach_query:PASS:bpf_obj_get_info_by_fd 0 nsec test_tp_attach_query:PASS:perf_event_open 0 nsec test_tp_attach_query:PASS:perf_event_ioc_enable 0 nsec test_tp_attach_query:PASS:perf_event_ioc_set_bpf 0 nsec test_tp_attach_query:PASS:perf_event_ioc_query_bpf 0 nsec test_tp_attach_query:PASS:perf_event_ioc_query_bpf 0 nsec test_tp_attach_query:PASS:perf_event_ioc_query_bpf 0 nsec test_tp_attach_query:PASS:perf_event_ioc_query_bpf 0 nsec test_stacktrace_map:PASS:prog_load 0 nsec test_stacktrace_map:PASS:open 0 nsec test_stacktrace_map:PASS:read 0 nsec test_stacktrace_map:PASS:perf_event_open 0 nsec test_stacktrace_map:PASS:perf_event_ioc_enable 0 nsec test_stacktrace_map:PASS:perf_event_ioc_set_bpf 0 nsec test_stacktrace_map:PASS:bpf_find_map control_map 0 nsec test_stacktrace_map:PASS:bpf_find_map stackid_hmap 0 nsec test_stacktrace_map:PASS:bpf_find_map stackmap 0 nsec test_stacktrace_map:PASS:compare_map_keys stackid_hmap vs. stackmap 0 nsec test_stacktrace_map:PASS:compare_map_keys stackmap vs. stackid_hmap 0 nsec Summary: 88 PASSED, 0 FAILED Thanks, Daniel > I shall appreciate a reply at your earliest convenience. > > thanks, > Shaoting Lei > > >