From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: "Toke Høiland-Jørgensen" <toke@redhat.com>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Alexei Starovoitov" <ast@kernel.org>,
"Martin KaFai Lau" <kafai@fb.com>,
"Song Liu" <songliubraving@fb.com>, "Yonghong Song" <yhs@fb.com>,
"Marek Majkowski" <marek@cloudflare.com>,
"Lorenz Bauer" <lmb@cloudflare.com>,
"Alan Maguire" <alan.maguire@oracle.com>,
"David Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, bpf@vger.kernel.org, brouer@redhat.com
Subject: Re: [PATCH bpf-next v3 1/5] bpf: Support chain calling multiple BPF programs after each other
Date: Wed, 9 Oct 2019 12:19:55 +0200 [thread overview]
Message-ID: <20191009121955.29cad5bb@carbon> (raw)
In-Reply-To: <20191009015117.pldowv6n3k5p3ghr@ast-mbp.dhcp.thefacebook.com>
On Tue, 8 Oct 2019 18:51:19 -0700
Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
> On Tue, Oct 08, 2019 at 10:07:46AM +0200, Toke Høiland-Jørgensen wrote:
> > Alexei Starovoitov <alexei.starovoitov@gmail.com> writes:
> >
> > > On Mon, Oct 07, 2019 at 07:20:36PM +0200, Toke Høiland-Jørgensen wrote:
> > >> From: Toke Høiland-Jørgensen <toke@redhat.com>
> > >>
> > >> This adds support for wrapping eBPF program dispatch in chain calling
> > >> logic. The code injection is controlled by a flag at program load time; if
> > >> the flag is set, the BPF program will carry a flag bit that changes the
> > >> program dispatch logic to wrap it in a chain call loop.
[...]
> > >> diff --git a/include/linux/filter.h b/include/linux/filter.h
> > >> index 2ce57645f3cd..3d1e4991e61d 100644
> > >> --- a/include/linux/filter.h
> > >> +++ b/include/linux/filter.h
[...]
> > >> #define BPF_PROG_RUN(prog, ctx) ({ \
> > >> @@ -559,14 +585,18 @@ DECLARE_STATIC_KEY_FALSE(bpf_stats_enabled_key);
> > >> if (static_branch_unlikely(&bpf_stats_enabled_key)) { \
> > >> struct bpf_prog_stats *stats; \
> > >> u64 start = sched_clock(); \
> > >> - ret = (*(prog)->bpf_func)(ctx, (prog)->insnsi); \
> > >> + ret = prog->chain_calls ? \
> > >> + do_chain_calls(prog, ctx) : \
> > >> + (*(prog)->bpf_func)(ctx, (prog)->insnsi); \
> > >
> > > I thought you agreed on 'no performance regressions' rule?
> >
> > As I wrote in the cover letter I could not measurable a performance
> > impact from this, even with the simplest possible XDP program (where
> > program setup time has the largest impact).
> >
> > This was the performance before/after patch (also in the cover letter):
> >
> > Before patch (XDP DROP program): 31.5 Mpps
> > After patch (XDP DROP program): 32.0 Mpps
> >
> > So actually this *increases* performance ;)
> > (Or rather, the difference is within the measurement uncertainty on my
> > system).
>
> I have hard time believing such numbers.
Don't look at this as +/- 500Kpps. Instead you have to realize that the
performance difference in ns (nano-seconds) is only 0.5 ns (0.496 ns).
(1/31.5*1000)-(1/32.0*1000) = 0.4960 ns
This "half-a-nanosec" is below the measurement uncertainty of any
system. My system have approx 2-3 ns measurement variance, which I'm
proud of. At these speeds (32Mpps) this e.g. 3 ns variance would
result in -2.8 Mpps (29.2Mpps).
The change Toke did in BPF_PROG_RUN does not introduce any measurable
performance change, as least on high-end Intel CPUs. This DOES satisfy
'no performance regressions' rule. You can dislike the solution for
other reasons ;-)
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
next prev parent reply other threads:[~2019-10-09 10:20 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-07 17:20 [PATCH bpf-next v3 0/5] xdp: Support multiple programs on a single interface through chain calls Toke Høiland-Jørgensen
2019-10-07 17:20 ` [PATCH bpf-next v3 1/5] bpf: Support chain calling multiple BPF programs after each other Toke Høiland-Jørgensen
2019-10-07 20:42 ` Alexei Starovoitov
2019-10-08 8:07 ` Toke Høiland-Jørgensen
2019-10-09 1:51 ` Alexei Starovoitov
2019-10-09 8:03 ` Toke Høiland-Jørgensen
2019-10-10 4:41 ` Alexei Starovoitov
2019-10-14 12:35 ` Toke Høiland-Jørgensen
2019-10-14 17:08 ` John Fastabend
2019-10-14 18:48 ` Toke Høiland-Jørgensen
2019-10-15 16:30 ` Edward Cree
2019-10-15 16:42 ` Toke Høiland-Jørgensen
2019-10-15 18:33 ` Edward Cree
2019-10-17 12:11 ` Toke Høiland-Jørgensen
2019-10-22 17:27 ` Edward Cree
2019-10-22 18:07 ` Toke Høiland-Jørgensen
2019-11-12 2:51 ` static and dynamic linking. Was: [PATCH bpf-next v3 1/5] bpf: Support chain calling multiple BPF Alexei Starovoitov
2019-11-12 16:20 ` Toke Høiland-Jørgensen
2019-11-12 19:52 ` Alexei Starovoitov
2019-11-12 21:25 ` Edward Cree
2019-11-12 23:18 ` Alexei Starovoitov
2019-11-13 18:30 ` Edward Cree
2019-11-13 18:51 ` Andrii Nakryiko
2019-11-15 2:13 ` Alexei Starovoitov
2019-11-15 16:56 ` John Fastabend
2019-11-12 23:25 ` John Fastabend
2019-11-13 0:21 ` Alexei Starovoitov
2019-11-13 5:33 ` John Fastabend
2019-11-15 1:50 ` Alexei Starovoitov
2019-11-15 16:39 ` John Fastabend
2019-11-14 15:41 ` Toke Høiland-Jørgensen
2019-11-12 16:32 ` Edward Cree
2019-11-15 11:48 ` Lorenz Bauer
2019-11-15 23:02 ` Alexei Starovoitov
2019-11-18 13:29 ` Lorenz Bauer
2019-10-21 23:51 ` [PATCH bpf-next v3 1/5] bpf: Support chain calling multiple BPF programs after each other Edward Cree
2019-10-16 2:28 ` Alexei Starovoitov
2019-10-16 8:27 ` Jesper Dangaard Brouer
2019-10-16 10:35 ` Daniel Borkmann
2019-10-16 11:16 ` Toke Høiland-Jørgensen
2019-10-16 13:51 ` Toke Høiland-Jørgensen
2019-10-19 20:09 ` bpf indirect calls Alexei Starovoitov
2019-10-20 10:58 ` Toke Høiland-Jørgensen
2019-10-25 16:30 ` Alexei Starovoitov
2019-10-27 12:15 ` Toke Høiland-Jørgensen
2023-09-27 13:27 ` Matt Bobrowski
2023-09-29 21:06 ` Alexei Starovoitov
2023-10-02 18:50 ` Barret Rhoden
2023-10-06 9:36 ` Matt Bobrowski
2023-10-06 18:49 ` Alexei Starovoitov
2023-10-19 12:28 ` Matt Bobrowski
2019-10-09 10:19 ` Jesper Dangaard Brouer [this message]
2019-10-09 17:57 ` [PATCH bpf-next v3 1/5] bpf: Support chain calling multiple BPF programs after each other Alexei Starovoitov
2019-10-07 17:20 ` [PATCH bpf-next v3 2/5] bpf: Add support for setting chain call sequence for programs Toke Høiland-Jørgensen
2019-10-07 20:38 ` Daniel Borkmann
2019-10-08 8:09 ` Toke Høiland-Jørgensen
2019-10-07 17:20 ` [PATCH bpf-next v3 3/5] tools: Update bpf.h header for program chain calls Toke Høiland-Jørgensen
2019-10-07 17:20 ` [PATCH bpf-next v3 4/5] libbpf: Add syscall wrappers for BPF_PROG_CHAIN_* commands Toke Høiland-Jørgensen
2019-10-07 17:20 ` [PATCH bpf-next v3 5/5] selftests: Add tests for XDP chain calls Toke Høiland-Jørgensen
2019-10-07 18:58 ` [PATCH bpf-next v3 0/5] xdp: Support multiple programs on a single interface through " John Fastabend
2019-10-08 8:42 ` Toke Høiland-Jørgensen
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=20191009121955.29cad5bb@carbon \
--to=brouer@redhat.com \
--cc=alan.maguire@oracle.com \
--cc=alexei.starovoitov@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=kafai@fb.com \
--cc=lmb@cloudflare.com \
--cc=marek@cloudflare.com \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=toke@redhat.com \
--cc=yhs@fb.com \
/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).