netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: David Laight <David.Laight@aculab.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev <netdev@vger.kernel.org>,
	"Jason A . Donenfeld" <Jason@zx2c4.com>
Subject: Re: [PATCH net-next 1/9] vlan: adopt u64_stats_t
Date: Wed, 8 Jun 2022 03:37:55 -0700	[thread overview]
Message-ID: <CANn89iJ8o+D86tOuO-ctPbaieNGOSM1dbfOYjMJERWH=r1P6Xw@mail.gmail.com> (raw)
In-Reply-To: <cea2c2c39d0e4f27b2e75cdbc8fce09d@AcuMS.aculab.com>

On Wed, Jun 8, 2022 at 3:18 AM David Laight <David.Laight@aculab.com> wrote:
>
> 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?

Be careful about using these kinds of words, some people get offended
quite easily.

>
> 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?
>

When needed, yes. KCSAN can catch real bugs, thank you.

> 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.

For these patches, code generation on x86 is actually exactly the same.

 Read https://lwn.net/Articles/793253

Then if you really think Jade Alglave, Will Deacon, Boqun Feng, David Howells,
 Daniel Lustig, Luc Maranget, Paul E. McKenney, Andrea Parri, Nicholas Piggin,
Alan Stern, Akira Yokosawa, and Peter Zijlstra were stupid, please
start a conversation
with them.

Thank you.

  reply	other threads:[~2022-06-08 10:39 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
2022-06-08 10:37     ` Eric Dumazet [this message]
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='CANn89iJ8o+D86tOuO-ctPbaieNGOSM1dbfOYjMJERWH=r1P6Xw@mail.gmail.com' \
    --to=edumazet@google.com \
    --cc=David.Laight@aculab.com \
    --cc=Jason@zx2c4.com \
    --cc=davem@davemloft.net \
    --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).