From: Florian Fainelli <f.fainelli@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemlot.net,
Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@savoirfairelinux.com>,
"David S. Miller" <davem@davemloft.net>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next] net: dsa: User per-cpu 64-bit statistics
Date: Fri, 4 Aug 2017 08:51:54 -0700 [thread overview]
Message-ID: <455c39d3-302e-68ab-3812-112c48ed48c2@gmail.com> (raw)
In-Reply-To: <1501824968.25002.35.camel@edumazet-glaptop3.roam.corp.google.com>
On 08/03/2017 10:36 PM, Eric Dumazet wrote:
> On Thu, 2017-08-03 at 21:33 -0700, Florian Fainelli wrote:
>> During testing with a background iperf pushing 1Gbit/sec worth of
>> traffic and having both ifconfig and ethtool collect statistics, we
>> could see quite frequent deadlocks. Convert the often accessed DSA slave
>> network devices statistics to per-cpu 64-bit statistics to remove these
>> deadlocks and provide fast efficient statistics updates.
>>
>
> This seems to be a bug fix, it would be nice to get a proper tag like :
>
> Fixes: f613ed665bb3 ("net: dsa: Add support for 64-bit statistics")
Right, should have been added, thanks!
>
> Problem here is that if multiple cpus can call dsa_switch_rcv() at the
> same time, then u64_stats_update_begin() contract is not respected.
This is really where I struggled understanding what is wrong in the
non-per CPU version, my understanding is that we have:
- writers for xmit executes in process context
- writers for receive executes from NAPI (from the DSA's master network
device through it's own NAPI doing netif_receive_skb -> netdev_uses_dsa
-> netif_receive_skb)
readers should all execute in process context. The test scenario that
led to a deadlock involved running iperf in the background, having a
while loop with both ifconfig and ethtool reading stats, and somehow
when iperf exited, either reader would just be locked. So I guess this
leaves us with the two writers not being mutually excluded then, right?
>
> include/linux/u64_stats_sync.h states :
>
> * Usage :
> *
> * Stats producer (writer) should use following template granted it already got
> * an exclusive access to counters (a lock is already taken, or per cpu
> * data is used [in a non preemptable context])
> *
> * spin_lock_bh(...) or other synchronization to get exclusive access
> * ...
> * u64_stats_update_begin(&stats->syncp);
>
>
>
--
Florian
next prev parent reply other threads:[~2017-08-04 15:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-04 4:33 [PATCH net-next] net: dsa: User per-cpu 64-bit statistics Florian Fainelli
2017-08-04 5:36 ` Eric Dumazet
2017-08-04 15:51 ` Florian Fainelli [this message]
2017-08-04 17:11 ` Eric Dumazet
2017-08-04 17:43 ` Eric Dumazet
2017-08-21 23:23 ` Florian Fainelli
2017-08-22 0:10 ` Florian Fainelli
2017-08-22 12:56 ` Eric Dumazet
2017-08-07 4:27 ` David Miller
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=455c39d3-302e-68ab-3812-112c48ed48c2@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=davem@davemlot.net \
--cc=eric.dumazet@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@savoirfairelinux.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).