lkml.org 
[lkml]   [2018]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] hv_netvsc: Add per-cpu ethtool stats for netvsc
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.

\
 
 \ /
  Last update: 2018-06-14 00:20    [W:0.041 / U:1.712 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site