From: Paolo Abeni <pabeni@redhat.com>
To: Josh Hunt <johunt@akamai.com>,
Jonas Bonn <jonas.bonn@netrounds.com>,
Cong Wang <xiyou.wangcong@gmail.com>
Cc: Michael Zhivich <mzhivich@akamai.com>,
David Miller <davem@davemloft.net>,
John Fastabend <john.fastabend@gmail.com>,
LKML <linux-kernel@vger.kernel.org>,
Linux Kernel Network Developers <netdev@vger.kernel.org>
Subject: Re: Packet gets stuck in NOLOCK pfifo_fast qdisc
Date: Tue, 07 Jul 2020 16:18:36 +0200 [thread overview]
Message-ID: <e54b0fe2ab12f6d078cdc6540f03478c32fe5735.camel@redhat.com> (raw)
In-Reply-To: <25ca46e4-a8c1-1c88-d6a9-603289ff44c3@akamai.com>
On Thu, 2020-07-02 at 11:08 -0700, Josh Hunt wrote:
> On 7/2/20 2:45 AM, Paolo Abeni wrote:
> > Hi all,
> >
> > On Thu, 2020-07-02 at 08:14 +0200, Jonas Bonn wrote:
> > > Hi Cong,
> > >
> > > On 01/07/2020 21:58, Cong Wang wrote:
> > > > On Wed, Jul 1, 2020 at 9:05 AM Cong Wang <xiyou.wangcong@gmail.com> wrote:
> > > > > On Tue, Jun 30, 2020 at 2:08 PM Josh Hunt <johunt@akamai.com> wrote:
> > > > > > Do either of you know if there's been any development on a fix for this
> > > > > > issue? If not we can propose something.
> > > > >
> > > > > If you have a reproducer, I can look into this.
> > > >
> > > > Does the attached patch fix this bug completely?
> > >
> > > It's easier to comment if you inline the patch, but after taking a quick
> > > look it seems too simplistic.
> > >
> > > i) Are you sure you haven't got the return values on qdisc_run reversed?
> >
> > qdisc_run() returns true if it was able to acquire the seq lock. We
> > need to take special action in the opposite case, so Cong's patch LGTM
> > from a functional PoV.
> >
> > > ii) There's a "bypass" path that skips the enqueue/dequeue operation if
> > > the queue is empty; that needs a similar treatment: after releasing
> > > seqlock it needs to ensure that another packet hasn't been enqueued
> > > since it last checked.
> >
> > That has been reverted with
> > commit 379349e9bc3b42b8b2f8f7a03f64a97623fff323
> >
> > ---
> > > diff --git a/net/core/dev.c b/net/core/dev.c
> > > index 90b59fc50dc9..c7e48356132a 100644
> > > --- a/net/core/dev.c
> > > +++ b/net/core/dev.c
> > > @@ -3744,7 +3744,8 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
> > >
> > > if (q->flags & TCQ_F_NOLOCK) {
> > > rc = q->enqueue(skb, q, &to_free) & NET_XMIT_MASK;
> > > - qdisc_run(q);
> > > + if (!qdisc_run(q) && rc == NET_XMIT_SUCCESS)
> > > + __netif_schedule(q);
> >
> > I fear the __netif_schedule() call may cause performance regression to
> > the point of making a revert of TCQ_F_NOLOCK preferable. I'll try to
> > collect some data.
>
> Initial results with Cong's patch look promising, so far no stalls. We
> will let it run over the long weekend and report back on Tuesday.
>
> Paolo - I have concerns about possible performance regression with the
> change as well. If you can gather some data that would be great.
I finally had the time to run some performance tests vs the above with
mixed results.
Using several netperf threadsover a single pfifo_fast queue with small
UDP packets, perf differences vs vanilla are just above noise range (1-
1,5%)
Using pktgen in 'queue_xmit' mode on a dummy device (this should
maximise the pkt-rate and thus the contention) I see:
pktgen threads vanilla patched delta
nr kpps kpps %
1 3240 3240 0
2 3910 2710 -30.5
4 5140 4920 -4
A relevant source of the measured overhead is due to the contention on
q->state in __netif_schedule, so the following helps a bit:
---
diff --git a/net/core/dev.c b/net/core/dev.c
index b8e8286a0a34..3cad6e086fac 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3750,7 +3750,8 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
if (q->flags & TCQ_F_NOLOCK) {
rc = q->enqueue(skb, q, NULL, &to_free) & NET_XMIT_MASK;
- if (!qdisc_run(q) && rc == NET_XMIT_SUCCESS)
+ if (!qdisc_run(q) && rc == NET_XMIT_SUCCESS &&
+ !test_bit(__QDISC_STATE_SCHED, &q->state))
__netif_schedule(q);
if (unlikely(to_free))
---
With the above incremental patch applied I see:
pktgen threads vanilla patched[II] delta
nr kpps kpps %
1 3240 3240 0
2 3910 2830 -27%
4 5140 5140 0
So the regression with 2 pktgen threads is still relevant. 'perf' shows
relevant time spent into net_tx_action() and __netif_schedule().
Cheers,
Paolo.
next prev parent reply other threads:[~2020-07-07 14:18 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-09 6:46 Packet gets stuck in NOLOCK pfifo_fast qdisc Jonas Bonn
2019-10-09 19:14 ` Paolo Abeni
2019-10-10 6:27 ` Jonas Bonn
2019-10-11 0:39 ` Jonas Bonn
2020-06-23 13:42 ` Michael Zhivich
2020-06-30 19:14 ` Josh Hunt
2020-07-01 7:53 ` Jonas Bonn
2020-07-01 16:05 ` Cong Wang
2020-07-01 19:58 ` Cong Wang
2020-07-01 22:02 ` Josh Hunt
2020-07-02 6:14 ` Jonas Bonn
2020-07-02 9:45 ` Paolo Abeni
2020-07-02 18:08 ` Josh Hunt
2020-07-07 14:18 ` Paolo Abeni [this message]
2020-07-08 20:16 ` Cong Wang
2020-07-09 9:20 ` Paolo Abeni
2020-07-08 20:33 ` Zhivich, Michael
2020-08-20 7:43 ` Jike Song
2020-08-20 18:13 ` Josh Hunt
[not found] ` <20200822032800.16296-1-hdanton@sina.com>
2020-08-25 2:18 ` Fengkehuan Feng
[not found] ` <20200825032312.11776-1-hdanton@sina.com>
2020-08-25 7:14 ` Fengkehuan Feng
[not found] ` <20200825162329.11292-1-hdanton@sina.com>
2020-08-26 2:38 ` Kehuan Feng
[not found] ` <CACS=qqKptAQQGiMoCs1Zgs9S4ZppHhasy1AK4df2NxnCDR+vCw@mail.gmail.com>
[not found] ` <5f46032e.1c69fb81.9880c.7a6cSMTPIN_ADDED_MISSING@mx.google.com>
2020-08-27 6:56 ` Kehuan Feng
[not found] ` <20200827125747.5816-1-hdanton@sina.com>
2020-08-28 1:45 ` Kehuan Feng
2020-09-03 5:01 ` Cong Wang
2020-09-03 8:39 ` Paolo Abeni
2020-09-03 17:43 ` Cong Wang
2020-09-04 5:07 ` John Fastabend
2020-09-10 20:15 ` Cong Wang
2020-09-10 21:07 ` John Fastabend
2020-09-10 21:40 ` Paolo Abeni
2021-04-02 19:25 ` Jiri Kosina
2021-04-02 19:33 ` Josh Hunt
[not found] ` <20210403003537.2032-1-hdanton@sina.com>
2021-04-03 12:23 ` Jiri Kosina
2021-04-06 0:55 ` Yunsheng Lin
2021-04-06 7:06 ` Michal Kubecek
2021-04-06 10:13 ` Juergen Gross
2021-04-06 12:17 ` Yunsheng Lin
2021-04-06 1:49 ` Cong Wang
2021-04-06 2:46 ` Yunsheng Lin
2021-04-06 7:31 ` Michal Kubecek
2021-04-06 12:24 ` Yunsheng Lin
[not found] ` <20200903101957.428-1-hdanton@sina.com>
2020-09-04 3:20 ` Kehuan Feng
2020-09-10 20:19 ` Cong Wang
2020-09-14 2:10 ` Yunsheng Lin
2020-09-17 19:52 ` Cong Wang
2020-09-18 2:06 ` Kehuan Feng
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=e54b0fe2ab12f6d078cdc6540f03478c32fe5735.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=john.fastabend@gmail.com \
--cc=johunt@akamai.com \
--cc=jonas.bonn@netrounds.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mzhivich@akamai.com \
--cc=netdev@vger.kernel.org \
--cc=xiyou.wangcong@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).