Subject: Re: linux-next: build warnings after merge of the access_once tree

From: "Paul E. McKenney" <[email-masked]>
Date: Thu, 26 Mar 2015 10:12:19 -0700

On Thu, Mar 26, 2015 at 09:37:50AM -0700, Linus Torvalds wrote:
> On Mar 26, 2015 9:29 AM, "Peter Zijlstra" <[email-masked]> wrote:
> >
> > And the size check in READ_ONCE() helps asserting this.
> 
> No it d does NOT.
> 
> Even the documentation you quoted agrees with me: the shearing issue is
> only for sizes where it is appropriate. The size check is wrong, because it
> warns explicitly about the sizes where the shearing will happen, but the
> code is supposed to work anyway.
> 
> All the documentation documents a *special case* (although a common one),
> not some generic requirement.
> 
> And the point is - the warning is wrong, and it is counterproductive. And
> it causes people who should know better to try to introduce bugs.
> 
> The warning must go. This whole thread proves it. The warning is dangerous
> and actively misleading.

The only cases I can think of where this warning would be useful is
in 64-bit architecture-specific code that used u64 (or long long or
whatever) and needed to avoid both reloads and load shearing.  In those
(admittedly rare, perhaps nonexistent) cases, presumably the surrounding
code should do __native_word() if needed.  (In case the code were to be
mindlessly copied to a 32-bit architecture or something.)

Not sure that adding this to memory-barriers.txt is worthwhile, just
trying to make sure that I understand the tradeoffs.

							Thanx, Paul