From: Jesper Dangaard Brouer <brouer@redhat.com>
To: "Björn Töpel" <bjorn.topel@gmail.com>
Cc: magnus.karlsson@intel.com, magnus.karlsson@gmail.com,
alexander.h.duyck@intel.com, alexander.duyck@gmail.com,
ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org,
jesse.brandeburg@intel.com, anjali.singhai@intel.com,
peter.waskiewicz.jr@intel.com,
"Björn Töpel" <bjorn.topel@intel.com>,
michael.lundkvist@ericsson.com, willemdebruijn.kernel@gmail.com,
john.fastabend@gmail.com, jakub.kicinski@netronome.com,
neerav.parikh@intel.com, mykyta.iziumtsev@linaro.org,
francois.ozog@linaro.org, ilias.apalodimas@linaro.org,
brian.brooks@linaro.org, u9012063@gmail.com,
pavel@fastnetmon.com, qi.z.zhang@intel.com, brouer@redhat.com
Subject: Re: [PATCH bpf-next 11/11] samples/bpf: add -c/--copy -z/--zero-copy flags to xdpsock
Date: Wed, 29 Aug 2018 14:44:46 +0200 [thread overview]
Message-ID: <20180829144446.72509a96@redhat.com> (raw)
In-Reply-To: <20180828124435.30578-12-bjorn.topel@gmail.com>
On Tue, 28 Aug 2018 14:44:35 +0200
Björn Töpel <bjorn.topel@gmail.com> wrote:
> From: Björn Töpel <bjorn.topel@intel.com>
>
> The -c/--copy -z/--zero-copy flags enforces either copy or zero-copy
> mode.
Nice, thanks for adding this. It allows me to quickly test the
difference between normal-copy vs zero-copy modes.
(Kernel bpf-next without RETPOLINE).
AF_XDP RX-drop:
Normal-copy mode: rx 13,070,318 pps - 76.5 ns
Zero-copy mode: rx 26,132,328 pps - 38.3 ns
Compare to XDP_DROP: 34,251,464 pps - 29.2 ns
XDP_DROP + read : 30,756,664 pps - 32.5 ns
The normal-copy mode is surprisingly fast (and it works for every
driver implemeting the regular XDP_REDIRECT action). It is still
faster to do in-kernel XDP_DROP than AF_XDP zero-copy mode dropping,
which was expected given frames travel to a remote CPU before returned
(don't think remote CPU reads payload?). The gap in nanosec is
actually quite small, thus I'm impressed by the SPSC-queue
implementation working across these CPUs.
AF_XDP layer2-fwd:
Normal-copy mode: rx 3,200,885 tx 3,200,892
Zero-copy mode: rx 17,026,300 tx 17,026,269
Compare to XDP_TX: rx 14,529,079 tx 14,529,850 - 68.82 ns
XDP_REDIRECT: rx 13,235,785 tx 13,235,784 - 75.55 ns
The copy-mode is slow because it allocates SKBs internally (I do
wonder if we could speed it up by using ndo_xdp_xmit + disable-BH).
More intersting is that the zero-copy is faster than XDP_TX and
XDP_REDIRECT. I think the speedup comes from avoiding some DMA mapping
calls with ZC.
Side-note: XDP_TX vs. REDIRECT: 75.55 - 68.82 = 6.73 ns. The cost of
going through the xdp_do_redirect_map core is actually quite small :-)
(I have some micro optimizations that should help ~2ns).
AF_XDP TX-only:
Normal-copy mode: tx 2,853,461 pps
Zero-copy mode: tx 22,255,311 pps
(There is not XDP mode that does TX to compare against)
--
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:[~2018-08-29 16:41 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-28 12:44 [PATCH bpf-next 00/11] AF_XDP zero-copy support for i40e Björn Töpel
2018-08-28 12:44 ` [PATCH bpf-next 01/11] xdp: implement convert_to_xdp_frame for MEM_TYPE_ZERO_COPY Björn Töpel
2018-08-28 14:11 ` Jesper Dangaard Brouer
2018-08-28 17:42 ` Björn Töpel
2018-08-29 18:06 ` [bpf-next, " Maciek Fijalkowski
2018-08-28 12:44 ` [PATCH bpf-next 02/11] xdp: export xdp_rxq_info_unreg_mem_model Björn Töpel
2018-08-28 12:44 ` [PATCH bpf-next 03/11] xsk: expose xdp_umem_get_{data,dma} to drivers Björn Töpel
2018-08-28 12:44 ` [PATCH bpf-next 04/11] net: add napi_if_scheduled_mark_missed Björn Töpel
2018-08-28 12:44 ` [PATCH bpf-next 05/11] i40e: added queue pair disable/enable functions Björn Töpel
2018-08-28 12:44 ` [PATCH bpf-next 06/11] i40e: refactor Rx path for re-use Björn Töpel
2018-08-28 12:44 ` [PATCH bpf-next 07/11] i40e: move common Rx functions to i40e_txrx_common.h Björn Töpel
2018-08-28 12:44 ` [PATCH bpf-next 08/11] i40e: add AF_XDP zero-copy Rx support Björn Töpel
2018-08-29 19:14 ` Jakub Kicinski
2018-08-30 12:06 ` Björn Töpel
2018-08-31 7:55 ` Jakub Kicinski
2018-08-29 19:22 ` Alexei Starovoitov
2018-08-28 12:44 ` [PATCH bpf-next 09/11] i40e: move common Tx functions to i40e_txrx_common.h Björn Töpel
2018-08-28 12:44 ` [PATCH bpf-next 10/11] i40e: add AF_XDP zero-copy Tx support Björn Töpel
2018-08-28 12:44 ` [PATCH bpf-next 11/11] samples/bpf: add -c/--copy -z/--zero-copy flags to xdpsock Björn Töpel
2018-08-29 12:44 ` Jesper Dangaard Brouer [this message]
2018-08-30 10:21 ` Björn Töpel
2018-08-28 12:50 ` [PATCH bpf-next 00/11] AF_XDP zero-copy support for i40e Björn Töpel
2018-08-29 16:12 ` Daniel Borkmann
2018-08-30 0:10 ` William Tu
2018-08-30 9:05 ` Björn Töpel
2018-08-29 19:19 ` [RFC] net: xsk: add a simple buffer reuse queue Jakub Kicinski
2018-08-31 8:34 ` Björn Töpel
2018-08-29 19:39 ` [PATCH bpf-next 00/11] AF_XDP zero-copy support for i40e Alexei Starovoitov
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=20180829144446.72509a96@redhat.com \
--to=brouer@redhat.com \
--cc=alexander.duyck@gmail.com \
--cc=alexander.h.duyck@intel.com \
--cc=anjali.singhai@intel.com \
--cc=ast@kernel.org \
--cc=bjorn.topel@gmail.com \
--cc=bjorn.topel@intel.com \
--cc=brian.brooks@linaro.org \
--cc=daniel@iogearbox.net \
--cc=francois.ozog@linaro.org \
--cc=ilias.apalodimas@linaro.org \
--cc=jakub.kicinski@netronome.com \
--cc=jesse.brandeburg@intel.com \
--cc=john.fastabend@gmail.com \
--cc=magnus.karlsson@gmail.com \
--cc=magnus.karlsson@intel.com \
--cc=michael.lundkvist@ericsson.com \
--cc=mykyta.iziumtsev@linaro.org \
--cc=neerav.parikh@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pavel@fastnetmon.com \
--cc=peter.waskiewicz.jr@intel.com \
--cc=qi.z.zhang@intel.com \
--cc=u9012063@gmail.com \
--cc=willemdebruijn.kernel@gmail.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).