public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Yidong Ren <Yidong.Ren@microsoft.com>
Cc: Yidong Ren <yidren@linuxonhyperv.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devel@linuxdriverproject.org" <devel@linuxdriverproject.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH v2] hv_netvsc: Add per-cpu ethtool stats for netvsc
Date: Wed, 13 Jun 2018 15:18:54 -0700	[thread overview]
Message-ID: <20180613151854.25be8b33@xeon-e3> (raw)
In-Reply-To: <SN6PR2101MB11353820325BBF4712076573847E0@SN6PR2101MB1135.namprd21.prod.outlook.com>

On Wed, 13 Jun 2018 22:03:34 +0000
Yidong Ren <Yidong.Ren@microsoft.com> wrote:

> > From: devel <driverdev-devel-bounces@linuxdriverproject.org> On Behalf
> > Of Stephen Hemminger  
> > > +/* statistics per queue (rx/tx packets/bytes) */ #define
> > > +NETVSC_PCPU_STATS_LEN (num_present_cpus() *  
> > ARRAY_SIZE(pcpu_stats))
> > 
> > Even though Hyper-V/Azure does not support hot plug cpu's it might be
> > better to num_cpu_possible to avoid any possible future surprises.  
> 
> That will create a very long output (num_cpu_possible = 128 on my machine) for ethtool,
> While doesn't provide additional info.
> num_present_cpus() would cause problem only if someone removed cpu 
> between netvsc_get_sset_count() and netvsc_get_strings() and netvsc_get_ethtool_stats(). 
> 
> An alternative way could be: Check all stats, and only output if not zero. 
> This need to be done in two pass. First pass to get the correct count, second pass to print the number.
> Is there an elegant way to do this? 

Ok, but there is a race between getting names and getting statistics.
If a cpu was added/removed then statistics would not match.

  reply	other threads:[~2018-06-13 22:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-13 19:36 [PATCH v2] hv_netvsc: Add per-cpu ethtool stats for netvsc Yidong Ren
2018-06-13 20:57 ` Eric Dumazet
2018-06-13 21:07   ` Yidong Ren
2018-06-13 21:48 ` Stephen Hemminger
2018-06-13 22:03   ` Yidong Ren
2018-06-13 22:18     ` Stephen Hemminger [this message]
2018-07-24  1:26 ` [PATCH v3] " Yidong Ren
2018-07-24  1:42   ` Yidong Ren
2018-07-24 11:00     ` Vitaly Kuznetsov
2018-07-25 22:54       ` Yidong Ren
2018-07-30 17:09   ` [PATCH v4 net-next] " Yidong Ren
2018-07-30 17:34     ` Stephen Hemminger
2018-07-30 19:34     ` 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=20180613151854.25be8b33@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=Yidong.Ren@microsoft.com \
    --cc=davem@davemloft.net \
    --cc=devel@linuxdriverproject.org \
    --cc=haiyangz@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sthemmin@microsoft.com \
    --cc=yidren@linuxonhyperv.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