[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1388679906.9947.1.camel@bwh-desktop.uk.level5networks.com>
Date: Thu, 2 Jan 2014 16:25:06 +0000
From: Ben Hutchings <bhutchings@...arflare.com>
To: Sabrina Dubroca <sd@...asysnail.net>
CC: David Miller <davem@...emloft.net>, <johannes@...solutions.net>,
<netdev@...r.kernel.org>
Subject: Re: [PATCH 4/5] alx: add alx_get_stats operation
On Thu, 2014-01-02 at 17:05 +0100, Sabrina Dubroca wrote:
> [2014-01-02, 11:56:53] Ben Hutchings wrote:
> > On Wed, 2014-01-01 at 22:27 -0500, David Miller wrote:
> > > From: Sabrina Dubroca <sd@...asysnail.net>
> > > Date: Thu, 2 Jan 2014 00:40:27 +0100
> > >
> > > > + spin_lock(&alx->stats_lock);
> > > > +
> > > > + __alx_update_hw_stats(&alx->hw);
> > >
> > > Please use something like the linux/u64_stats_sync.h stuff rather
> > > than spin locking.
> >
> > I don't think that'sa useful, as we can have multiple writers
> > (concurrent calls to get_stats). And there is really no harm in using a
> > spinlock to serialise get_stats calls. The u64_stats API is good for
> > statistics updated from the data path.
>
> I've read the comments in linux/u64_stats_sync.h, which mentions the
> need for exclusive access to the data. I've looked at other drivers
> (broadcom/b44.c, nvidia/forcedeth.c) that use the u64_stats functions
> to get stats from hardware, and they use a spin_lock around the update
> code. The other drivers that I've looked at and that use u64_stats
> have software stats that they update on rx/tx, so I think the
> situation is a bit different.
>
>
> For now I've added u64_stats and modified the functions this way:
[...]
You could do that but I think your original version was fine. Of course
it is David's decision in the end.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists