bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Eelco Chaudron" <echaudro@redhat.com>
To: "Andrii Nakryiko" <andrii.nakryiko@gmail.com>
Cc: bpf <bpf@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Alexei Starovoitov" <ast@kernel.org>,
	Networking <netdev@vger.kernel.org>
Subject: Re: [PATCH bpf-next] selftests/bpf: Add a test for attaching a bpf fentry/fexit trace to an XDP program
Date: Mon, 23 Dec 2019 13:53:59 +0100	[thread overview]
Message-ID: <FE4A1C64-70CF-4831-922C-F3992C40E57B@redhat.com> (raw)
In-Reply-To: <CAEf4BzYxDE5VoBiCaPwv=buUk87Cv0JF09usmQf0WvUceb8A5A@mail.gmail.com>



On 20 Dec 2019, at 0:02, Andrii Nakryiko wrote:

> On Thu, Dec 19, 2019 at 3:04 AM Eelco Chaudron <echaudro@redhat.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@redhat.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;
>> +}
>>


  reply	other threads:[~2019-12-23 12:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-19 11:03 [PATCH bpf-next] selftests/bpf: Add a test for attaching a bpf fentry/fexit trace to an XDP program Eelco Chaudron
2019-12-19 23:02 ` Andrii Nakryiko
2019-12-23 12:53   ` Eelco Chaudron [this message]
2019-12-23 17:57     ` Andrii Nakryiko
2019-12-24 15:49       ` Eelco Chaudron
2020-01-02 14:13   ` Eelco Chaudron
2020-01-09  5:04     ` Andrii Nakryiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FE4A1C64-70CF-4831-922C-F3992C40E57B@redhat.com \
    --to=echaudro@redhat.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).