netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Eric Dumazet' <eric.dumazet@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: netdev <netdev@vger.kernel.org>,
	"Jason A . Donenfeld" <Jason@zx2c4.com>,
	Eric Dumazet <edumazet@google.com>
Subject: RE: [PATCH net-next 1/9] vlan: adopt u64_stats_t
Date: Wed, 8 Jun 2022 10:18:22 +0000	[thread overview]
Message-ID: <cea2c2c39d0e4f27b2e75cdbc8fce09d@AcuMS.aculab.com> (raw)
In-Reply-To: <20220607233614.1133902-2-eric.dumazet@gmail.com>

From: Eric Dumazet
> Sent: 08 June 2022 00:36
> 
> As explained in commit 316580b69d0a ("u64_stats: provide u64_stats_t type")
> we should use u64_stats_t and related accessors to avoid load/store tearing.
> 
> Add READ_ONCE() when reading rx_errors & tx_dropped.

Isn't this all getting entirely stupid?

AFAICT nearly every 'memory' access in the kernel is going
to get wrapped in READ/WRITE_ONCE() to avoid something
that really never actually happens?

It might be better to just mark everything 'volatile'.
Although perhaps that ought to be a compiler option.

OTOH I've seen gcc generate extra instructions for 'volatile'
accesses - to the point where I used 'barrier()' to optimise
code.
I think the volatile casts in READ_ONCE() can generate worse
code than volatile variables.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  reply	other threads:[~2022-06-08 10:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07 23:36 [PATCH net-next 0/9] net: Eric Dumazet
2022-06-07 23:36 ` [PATCH net-next 1/9] vlan: adopt u64_stats_t Eric Dumazet
2022-06-08 10:18   ` David Laight [this message]
2022-06-08 10:37     ` Eric Dumazet
2022-06-07 23:36 ` [PATCH net-next 2/9] ipvlan: " Eric Dumazet
2022-06-07 23:36 ` [PATCH net-next 3/9] sit: use dev_sw_netstats_rx_add() Eric Dumazet
2022-06-07 23:36 ` [PATCH net-next 4/9] ip6_tunnel: " Eric Dumazet
2022-06-07 23:36 ` [PATCH net-next 5/9] wireguard: " Eric Dumazet
2022-06-08  7:36   ` Jason A. Donenfeld
2022-06-08 15:41     ` Eric Dumazet
2022-06-07 23:36 ` [PATCH net-next 6/9] net: adopt u64_stats_t in struct pcpu_sw_netstats Eric Dumazet
2022-06-07 23:36 ` [PATCH net-next 7/9] devlink: adopt u64_stats_t Eric Dumazet
2022-06-07 23:36 ` [PATCH net-next 8/9] drop_monitor: " Eric Dumazet
2022-06-07 23:36 ` [PATCH net-next 9/9] team: " Eric Dumazet

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=cea2c2c39d0e4f27b2e75cdbc8fce09d@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=Jason@zx2c4.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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).