On Sat, Mar 16, 2019 at 07:20:20PM -0700, James Bottomley wrote: > On Sat, 2019-03-16 at 17:50 -0700, Paul E. McKenney wrote: > [...] > > I -have- seen stores of constant values be torn, but not stores of > > runtime-variable values and not loads. Still, such tearing is > > permitted, and including the READ_ONCE() is making it easier for > > things like thread sanitizers. In addition, the READ_ONCE() makes it > > clear that the value being loaded is unstable, which can be > > useful documentation. > > Um, just so I'm clear, because this assumption permeates all our code: > load or store tearing can never occur if we're doing load or store of a > 32 bit value which is naturally aligned. Where naturally aligned is > within the gift of the CPU to determine but which the compiler or > kernel will always ensure for us unless we pack the structure or > deliberately misalign the allocation. Wait a sec; are there any 64bit architectures where the same is not guaranteed for dereferencing properly aligned void **? If that's the case, I can think of quite a few places that are rather dubious, and I don't see how READ_ONCE() could help in those - e.g. if an architecture only has 32bit loads, rcu list traversals are not going to be doable without one hell of an extra headache.