From: Toshiaki Makita <toshiaki.makita1@gmail.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>,
"Toshiaki Makita" <makita.toshiaki@lab.ntt.co.jp>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"David S. Miller" <davem@davemloft.net>,
"Jakub Kicinski" <jakub.kicinski@netronome.com>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
"John Fastabend" <john.fastabend@gmail.com>
Cc: netdev@vger.kernel.org, xdp-newbies@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 3/3] veth: Support bulk XDP_TX
Date: Thu, 23 May 2019 22:40:09 +0900 [thread overview]
Message-ID: <0439f845-16cd-20ef-65e2-ebe6da11d57a@gmail.com> (raw)
In-Reply-To: <87sgt51i0e.fsf@toke.dk>
On 19/05/23 (木) 21:18:25, Toke Høiland-Jørgensen wrote:
> Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp> writes:
>
>> On 2019/05/23 20:25, Toke Høiland-Jørgensen wrote:
>>> Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp> writes:
>>>
>>>> This improves XDP_TX performance by about 8%.
>>>>
>>>> Here are single core XDP_TX test results. CPU consumptions are taken
>>>> from "perf report --no-child".
>>>>
>>>> - Before:
>>>>
>>>> 7.26 Mpps
>>>>
>>>> _raw_spin_lock 7.83%
>>>> veth_xdp_xmit 12.23%
>>>>
>>>> - After:
>>>>
>>>> 7.84 Mpps
>>>>
>>>> _raw_spin_lock 1.17%
>>>> veth_xdp_xmit 6.45%
>>>>
>>>> Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
>>>> ---
>>>> drivers/net/veth.c | 26 +++++++++++++++++++++++++-
>>>> 1 file changed, 25 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
>>>> index 52110e5..4edc75f 100644
>>>> --- a/drivers/net/veth.c
>>>> +++ b/drivers/net/veth.c
>>>> @@ -442,6 +442,23 @@ static int veth_xdp_xmit(struct net_device *dev, int n,
>>>> return ret;
>>>> }
>>>>
>>>> +static void veth_xdp_flush_bq(struct net_device *dev)
>>>> +{
>>>> + struct xdp_tx_bulk_queue *bq = this_cpu_ptr(&xdp_tx_bq);
>>>> + int sent, i, err = 0;
>>>> +
>>>> + sent = veth_xdp_xmit(dev, bq->count, bq->q, 0);
>>>
>>> Wait, veth_xdp_xmit() is just putting frames on a pointer ring. So
>>> you're introducing an additional per-cpu bulk queue, only to avoid lock
>>> contention around the existing pointer ring. But the pointer ring is
>>> per-rq, so if you have lock contention, this means you must have
>>> multiple CPUs servicing the same rq, no?
>>
>> Yes, it's possible. Not recommended though.
>>
>>> So why not just fix that instead?
>>
>> The queues are shared with packets from stack sent from peer. That's
>> because I needed the lock. I have tried to separate the queues, one for
>> redirect and one for stack, but receiver side got too complicated and it
>> ended up with worse performance.
>
> I meant fix it with configuration. Now many receive queues are you
> running on the veth device in your benchmarks, and how have you
> configured the RPS?
As I wrote this test is a single queue test and does not have any
contention.
Per packet lock has some overhead even in that configuration.
Toshiaki Makita
next prev parent reply other threads:[~2019-05-23 13:40 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-23 10:56 [PATCH bpf-next 0/3] veth: Bulk XDP_TX Toshiaki Makita
2019-05-23 10:56 ` [PATCH bpf-next 1/3] xdp: Add bulk XDP_TX queue Toshiaki Makita
2019-05-23 11:11 ` Toke Høiland-Jørgensen
2019-05-23 11:24 ` Toshiaki Makita
2019-05-23 11:33 ` Toke Høiland-Jørgensen
2019-05-23 10:56 ` [PATCH bpf-next 2/3] xdp: Add tracepoint for bulk XDP_TX Toshiaki Makita
2019-05-23 13:12 ` Jesper Dangaard Brouer
2019-05-24 1:33 ` Toshiaki Makita
2019-05-23 10:56 ` [PATCH bpf-next 3/3] veth: Support " Toshiaki Makita
2019-05-23 11:25 ` Toke Høiland-Jørgensen
2019-05-23 11:35 ` Toshiaki Makita
2019-05-23 12:18 ` Toke Høiland-Jørgensen
2019-05-23 13:40 ` Toshiaki Makita [this message]
2019-05-23 13:29 ` Jesper Dangaard Brouer
2019-05-23 13:51 ` Toshiaki Makita
2019-05-24 3:13 ` Jason Wang
2019-05-24 3:28 ` Toshiaki Makita
2019-05-24 3:54 ` Jason Wang
2019-05-24 4:52 ` Toshiaki Makita
2019-05-24 9:53 ` Jesper Dangaard Brouer
2019-05-27 6:08 ` Toshiaki Makita
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=0439f845-16cd-20ef-65e2-ebe6da11d57a@gmail.com \
--to=toshiaki.makita1@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=hawk@kernel.org \
--cc=jakub.kicinski@netronome.com \
--cc=john.fastabend@gmail.com \
--cc=makita.toshiaki@lab.ntt.co.jp \
--cc=netdev@vger.kernel.org \
--cc=toke@redhat.com \
--cc=xdp-newbies@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).