From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751996AbdHDFgO (ORCPT ); Fri, 4 Aug 2017 01:36:14 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:38862 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751301AbdHDFgM (ORCPT ); Fri, 4 Aug 2017 01:36:12 -0400 Message-ID: <1501824968.25002.35.camel@edumazet-glaptop3.roam.corp.google.com> Subject: Re: [PATCH net-next] net: dsa: User per-cpu 64-bit statistics From: Eric Dumazet To: Florian Fainelli Cc: netdev@vger.kernel.org, davem@davemlot.net, Andrew Lunn , Vivien Didelot , "David S. Miller" , open list Date: Thu, 03 Aug 2017 22:36:08 -0700 In-Reply-To: <20170804043328.4730-1-f.fainelli@gmail.com> References: <20170804043328.4730-1-f.fainelli@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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") 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. 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);