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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 21 Nov 2013 13:16:29 -0800
From:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:	Josh Triplett <josh@...htriplett.org>
Cc:	linux-kernel@...r.kernel.org, mingo@...nel.org,
	laijs@...fujitsu.com, dipankar@...ibm.com,
	akpm@...ux-foundation.org, mathieu.desnoyers@...icios.com,
	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
Subject: Re: [PATCH RFC tip/core/rcu 1/3] documentation: Add needed
 ACCESS_ONCE() calls to memory-barriers.txt

On Thu, Nov 21, 2013 at 11:43:35AM -0800, Josh Triplett wrote:
> On Thu, Nov 21, 2013 at 09:48:45AM -0800, Paul E. McKenney wrote:
> > From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
> > 
> > The Documentation/memory-barriers.txt file was written before the need
> > for ACCESS_ONCE() was fully appreciated.  It therefore contains no
> > ACCESS_ONCE() calls, which can be a problem when people lift examples
> > from it.  This commit therefore adds ACCESS_ONCE() calls.
> > 
> > Signed-off-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
> > Cc: David Howells <dhowells@...hat.com>
> > ---
> >  Documentation/memory-barriers.txt | 204 +++++++++++++++++++++++---------------
> >  1 file changed, 124 insertions(+), 80 deletions(-)
> > 
> > diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
> > index c8c42e64e953..eccc83a40ce1 100644
> > --- a/Documentation/memory-barriers.txt
> > +++ b/Documentation/memory-barriers.txt
> > @@ -194,18 +194,20 @@ There are some minimal guarantees that may be expected of a CPU:
> >   (*) On any given CPU, dependent memory accesses will be issued in order, with
> >       respect to itself.  This means that for:
> >  
> > -	Q = P; D = *Q;
> > +	ACCESS_ONCE(Q) = P; smp_memory_barrier_depends(); D = ACCESS_ONCE(*Q);
> 
> That should be smp_read_barrier_depends().

Good catch!  I guess the smp_memory_barrier_depends() was a barrier in
my own brain preventing my memory from serving up the correct API.  ;-)

> Also, most of the time shouldn't that use rcu_dereference rather than a
> raw smp_read_barrier_depends()?

Good point -- I added a later sentence reading:

	Please note that you should normally use something
	like rcu_dereference() instead of open-coding
	smp_read_barrier_depends().

Using rcu_dereference() in the example itself would obscure the point,
so I left the smp_read_barrier_depends().

							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