From: Jakub Kicinski <kuba@kernel.org>
To: Moon Yeounsu <yyyynoom@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: dlink: add synchronization for stats update
Date: Wed, 23 Apr 2025 18:42:35 -0700 [thread overview]
Message-ID: <20250423184235.0242ae79@kernel.org> (raw)
In-Reply-To: <20250421191645.43526-2-yyyynoom@gmail.com>
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
prev parent reply other threads:[~2025-04-24 1:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-21 19:16 [PATCH net-next] net: dlink: add synchronization for stats update Moon Yeounsu
2025-04-21 23:23 ` Jacob Keller
2025-04-22 22:53 ` Moon Yeounsu
2025-04-23 16:28 ` Jacob Keller
2025-04-24 1:42 ` Jakub Kicinski [this message]
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=20250423184235.0242ae79@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=yyyynoom@gmail.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;
as well as URLs for NNTP newsgroup(s).