[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cea2c2c39d0e4f27b2e75cdbc8fce09d@AcuMS.aculab.com>
Date: Wed, 8 Jun 2022 10:18:22 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Eric Dumazet' <eric.dumazet@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
CC: netdev <netdev@...r.kernel.org>,
"Jason A . Donenfeld" <Jason@...c4.com>,
Eric Dumazet <edumazet@...gle.com>
Subject: RE: [PATCH net-next 1/9] vlan: adopt u64_stats_t
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)
Powered by blists - more mailing lists