[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <FE4A1C64-70CF-4831-922C-F3992C40E57B@redhat.com>
Date: Mon, 23 Dec 2019 13:53:59 +0100
From: "Eelco Chaudron" <echaudro@...hat.com>
To: "Andrii Nakryiko" <andrii.nakryiko@...il.com>
Cc: bpf <bpf@...r.kernel.org>, "David S. Miller" <davem@...emloft.net>,
"Alexei Starovoitov" <ast@...nel.org>,
Networking <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf-next] selftests/bpf: Add a test for attaching a bpf
fentry/fexit trace to an XDP program
On 20 Dec 2019, at 0:02, Andrii Nakryiko wrote:
> On Thu, Dec 19, 2019 at 3:04 AM Eelco Chaudron <echaudro@...hat.com>
> wrote:
>>
>> Add a test that will attach a FENTRY and FEXIT program to the XDP
>> test
>> program. It will also verify data from the XDP context on FENTRY and
>> verifies the return code on exit.
>>
>> Signed-off-by: Eelco Chaudron <echaudro@...hat.com>
>> ---
>> .../testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c | 95
>> ++++++++++++++++++++
>> .../testing/selftests/bpf/progs/test_xdp_bpf2bpf.c | 44 +++++++++
>> 2 files changed, 139 insertions(+)
>> create mode 100644
>> tools/testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c
>> create mode 100644
>> tools/testing/selftests/bpf/progs/test_xdp_bpf2bpf.c
>>
>
> [...]
Thanks for the review, updated my kernel to the latest bfp-next, but now
I get the following build issue for the test suite:
GEN-SKEL [test_progs] loop3.skel.h
GEN-SKEL [test_progs] test_skeleton.skel.h
libbpf: failed to find BTF for extern 'CONFIG_BPF_SYSCALL': -2
Error: failed to open BPF object file: 0
make: *** [Makefile:333:
/data/linux_kernel/tools/testing/selftests/bpf/test_skeleton.skel.h]
Error 255
make: *** Deleting file
'/data/linux_kernel/tools/testing/selftests/bpf/test_skeleton.skel.h'
Verified, and I still have all the correct config and CLANG version.
Something else I need to update?
I have pahole v1.15 in my search path…
>
>> + /* Load XDP program to introspect */
>> + err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd);
>
> Please use BPF skeleton for this test. It will make it significantly
> shorter and clearer. See other fentry_fexit selftest for example.
>
>> + if (CHECK_FAIL(err))
>> + return;
>> +
>
> [...]
>
>> +
>> +static volatile __u64 test_result_fentry;
>
> no need for static volatile anymore, just use global var
>
>> +BPF_TRACE_1("fentry/_xdp_tx_iptunnel", trace_on_entry,
>> + struct xdp_buff *, xdp)
>> +{
>> + test_result_fentry = xdp->rxq->dev->ifindex;
>> + return 0;
>> +}
>> +
>> +static volatile __u64 test_result_fexit;
>
> same here
>
>> +BPF_TRACE_2("fexit/_xdp_tx_iptunnel", trace_on_exit,
>> + struct xdp_buff*, xdp, int, ret)
>> +{
>> + test_result_fexit = ret;
>> + return 0;
>> +}
>>
Powered by blists - more mailing lists