lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ+HfNjMyT3Ye=gyKDUkqsYJxngGp-tpV_m+C93uHbbyxbYoyQ@mail.gmail.com>
Date:   Tue, 10 Dec 2019 12:56:23 +0100
From:   Björn Töpel <bjorn.topel@...il.com>
To:     Jesper Dangaard Brouer <brouer@...hat.com>
Cc:     Netdev <netdev@...r.kernel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Björn Töpel <bjorn.topel@...el.com>,
        bpf <bpf@...r.kernel.org>,
        Magnus Karlsson <magnus.karlsson@...il.com>,
        "Karlsson, Magnus" <magnus.karlsson@...el.com>,
        Jonathan Lemon <jonathan.lemon@...il.com>,
        Edward Cree <ecree@...arflare.com>,
        Toke Høiland-Jørgensen <thoiland@...hat.com>,
        Andrii Nakryiko <andrii.nakryiko@...il.com>
Subject: Re: [PATCH bpf-next v3 5/6] selftests: bpf: add xdp_perf test

On Tue, 10 Dec 2019 at 12:05, Jesper Dangaard Brouer <brouer@...hat.com> wrote:
>
> On Mon,  9 Dec 2019 14:55:21 +0100
> Björn Töpel <bjorn.topel@...il.com> wrote:
>
> > From: Björn Töpel <bjorn.topel@...el.com>
> >
> > The xdp_perf is a dummy XDP test, only used to measure the the cost of
> > jumping into a XDP program.
>
> I really like this idea of performance measuring XDP-core in isolation.
> This is the ultimate zoom-in micro-benchmarking.  I see a use-case for
> this, where I will measure the XDP-core first, and then run same XDP
> prog (e.g. XDP_DROP) on a NIC driver, then I can deduct/isolate the
> driver-code and hardware overhead.  We/I can also use it to optimize
> e.g. REDIRECT code-core (although redir might not actually work).
>
> IMHO it would be valuable to have bpf_prog_load() also measure the
> perf-HW counters for 'cycles' and 'instructions', as in your case the
> performance optimization was to improve the instructions-per-cycle
> (which you showed via perf stat in cover letter).
>
>
> If you send a V4 please describe how to use this prog to measure the
> cost, as you describe in cover letter.
>
> from selftests/bpf run:
>  # test_progs -v -t xdp_perf
>
> (This is a nitpick, so only do this if something request a V4)
>

I'll definitely do a v4! Thanks for the input/comments! I'll address
them in the next rev!

Cheers,
Björn

>
> > Signed-off-by: Björn Töpel <bjorn.topel@...el.com>
> > ---
> >  .../selftests/bpf/prog_tests/xdp_perf.c       | 25 +++++++++++++++++++
> >  1 file changed, 25 insertions(+)
> >  create mode 100644 tools/testing/selftests/bpf/prog_tests/xdp_perf.c
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_perf.c b/tools/testing/selftests/bpf/prog_tests/xdp_perf.c
> > new file mode 100644
> > index 000000000000..7185bee16fe4
> > --- /dev/null
> > +++ b/tools/testing/selftests/bpf/prog_tests/xdp_perf.c
> > @@ -0,0 +1,25 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +#include <test_progs.h>
> > +
> > +void test_xdp_perf(void)
> > +{
> > +     const char *file = "./xdp_dummy.o";
> > +     __u32 duration, retval, size;
> > +     struct bpf_object *obj;
> > +     char in[128], out[128];
> > +     int err, prog_fd;
> > +
> > +     err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd);
> > +     if (CHECK_FAIL(err))
> > +             return;
> > +
> > +     err = bpf_prog_test_run(prog_fd, 1000000, &in[0], 128,
> > +                             out, &size, &retval, &duration);
> > +
> > +     CHECK(err || retval != XDP_PASS || size != 128,
> > +           "xdp-perf",
> > +           "err %d errno %d retval %d size %d\n",
> > +           err, errno, retval, size);
> > +
> > +     bpf_object__close(obj);
> > +}
>
>
>
> --
> Best regards,
>   Jesper Dangaard Brouer
>   MSc.CS, Principal Kernel Engineer at Red Hat
>   LinkedIn: http://www.linkedin.com/in/brouer
>
> --
> Best regards,
>   Jesper Dangaard Brouer
>   MSc.CS, Principal Kernel Engineer at Red Hat
>   LinkedIn: http://www.linkedin.com/in/brouer
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ