lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20131210200936.GE4208@linux.vnet.ibm.com>
Date:	Tue, 10 Dec 2013 12:09:36 -0800
From:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:	Ingo Molnar <mingo@...nel.org>
Cc:	Jonathan Corbet <corbet@....net>, linux-kernel@...r.kernel.org,
	laijs@...fujitsu.com, dipankar@...ibm.com,
	akpm@...ux-foundation.org, mathieu.desnoyers@...icios.com,
	josh@...htriplett.org, niv@...ibm.com, tglx@...utronix.de,
	peterz@...radead.org, rostedt@...dmis.org, dhowells@...hat.com,
	edumazet@...gle.com, darren@...art.com, fweisbec@...il.com,
	sbw@....edu, Oleg Nesterov <oleg@...hat.com>,
	Rusty Russell <rusty@...tcorp.com.au>
Subject: Re: [PATCH tip/core/locking 4/4] Documentation/memory-barriers.txt:
 Document ACCESS_ONCE()

On Tue, Dec 10, 2013 at 08:46:28PM +0100, Ingo Molnar wrote:
> 
> * Paul E. McKenney <paulmck@...ux.vnet.ibm.com> wrote:
> 
> > > So, what I don't see this statement cover (and I might be dense about 
> > > it!) is whether two ACCESS_ONCE() macros referring to different 
> > > variables are allowed to be reordered with each other.
> > > 
> > > If the compiler reorders:
> > > 
> > > 	ACCESS_ONCE(x);
> > > 	ACCESS_ONCE(y);
> > > 
> > > to:
> > > 
> > > 	ACCESS_ONCE(y);
> > > 	ACCESS_ONCE(x);
> > > 
> > > then AFAICS it still meets the "compiler need only forget the contents 
> > > of the indicated memory located" requirement that you listed, right?
> > 
> > True, but if the compiler was willing to reorder ACCESS_ONCE()'s 
> > volatile accesses, it would be really hard to write reliable device 
> > drivers. [...]
> 
> But nowhere do we link ACCESS_ONCE() to 'volatile' semantics in the 
> document, do we? (and I'm not sure we should.)

Agreed, stating ACCESS_ONCE()'s semantics separately is better.

> [ In theory a future compiler could offer a smarter, more flexible 
>   'compiler barrier' implementation - at which point we might be 
>   tempted to use that new facility to implement ACCESS_ONCE(). At that 
>   point this ambiguity might arise. ]

And they are trying to obsolete volatile, but haven't quite got there
yet.  ;-)

> > [...]  The standard says the following:
> > 
> > 	Access to volatile objects are evaluated strictly according to
> > 	the rules of the abstract machine.
> > 
> > That said, compiler writers and standards wonks will argue endlessly 
> > about exactly what that does and does not mean.  :-/
> > 
> > I added a sentence reading:
> > 
> > 	Of course, the compiler must also respect the order in which
> > 	the ACCESS_ONCE()s occur, though the CPU of course need not do so.
> > 
> > To the end of that paragraph.  Does that help?
> 
> Yeah, that looks perfect!

Very good!

							Thanx, Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ