[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250423184235.0242ae79@kernel.org>
Date: Wed, 23 Apr 2025 18:42:35 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Moon Yeounsu <yyyynoom@...il.com>
Cc: Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Paolo Abeni
<pabeni@...hat.com>, netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] net: dlink: add synchronization for stats
update
On Tue, 22 Apr 2025 04:16:44 +0900 Moon Yeounsu wrote:
> - dev->stats.tx_errors++;
> + np->tx_errors++;
> /* Ttransmit Underrun */
> if (tx_status & 0x10) {
> dev->stats.tx_fifo_errors++;
> @@ -904,7 +904,7 @@ tx_error (struct net_device *dev, int tx_status)
> }
> /* Maximum Collisions */
> if (tx_status & 0x08)
> - dev->stats.collisions++;
> + np->collisions++;
These can be updated concurrently with the reading.
Since they are 64b on 32b machines the update may not be atomic.
So to be safe please take the spin lock around the increments,
or you could convert them to a atomic_t, or you can make them 32 bits
and update them with WRITE_ONCE() read with READ_ONCE()..
--
pw-bot: cr
Powered by blists - more mailing lists