Re: [PATCH net-next 3/4] net: dsa: motorcomm: Use u64_stats_t for MIB stats
From: Andrew Lunn
Date: Fri Sep 04 2026 - 09:40:47 EST
On Fri, Sep 04, 2026 at 10:58:06AM +0800, David Yang wrote:
> On Fri, Sep 4, 2026 at 12:25 AM Andrew Lunn <andrew@xxxxxxx> wrote:
> >
> > On Thu, Sep 03, 2026 at 10:35:08PM +0800, David Yang wrote:
> > > 64-bit variables might not be atomic on 32-bit architectures, and could
> > > lead to load/store tearing. Use u64_stats_t to ensure consistency.
> >
> > Can this patch also be broken up. It should be possible to use
> > u64_stats_read() without changing the locking? So one patch which only
> > does u64_stats_read(). You should then be able to add the syncp
> > code. And lastly the mutex changes. That then allows you to explain
> > why the mutex changes are safe in the commit message.
> >
> > Andrew
>
> u64_stats_read are meant to be used with syncp. This sounds like an
> incorrect partial patch, works only because of the internal
> implementation of u64_stats_t.
What is making the current code correct? The mutex? So long as you
have the mutex, the code is still correct?
You can say in the commit message this is an intermediary step doing
the mechanical work of introducing u64_stats_t. The following patches
will then change the locking to be more efficient.
Andrew