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] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 13 Apr 2015 11:42:53 -0700
From:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Ingo Molnar <mingo@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Rusty Russell <rusty@...tcorp.com.au>,
	Oleg Nesterov <oleg@...hat.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Andi Kleen <andi@...stfloor.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Lai Jiangshan <laijs@...fujitsu.com>,
	George Spelvin <linux@...izon.com>,
	Andrea Arcangeli <aarcange@...hat.com>,
	David Woodhouse <David.Woodhouse@...el.com>,
	Rik van Riel <riel@...hat.com>,
	Michel Lespinasse <walken@...gle.com>
Subject: Re: [PATCH v5 05/10] seqlock: Better document
 raw_write_seqcount_latch()

On Mon, Apr 13, 2015 at 11:21:46AM -0700, Linus Torvalds wrote:
> On Mon, Apr 13, 2015 at 10:43 AM, Paul E. McKenney
> <paulmck@...ux.vnet.ibm.com> wrote:
> >
> > A shorthand for READ_ONCE + smp_read_barrier_depends() is the shiny
> > new lockless_dereference()
> 
> Related side note - I think people should get used to seeing
> "smp_load_acquire()". It has well-defined memory ordering properties
> and should generally perform well on most architectures. It's (much)
> stronger than lockless_dereference(), and together with
> smp_store_release() you can make rather clear guarantees about passing
> data locklessly from one CPU to another.
> 
> I'd like to see us use more of the pattern of
> 
>  - one thread does:
> 
>      .. allocate/create some data
>       smp_store_release() to "expose it"
> 
>  - another thread does:
> 
>       smp_load_acquire() to read index/pointer/flag/whatever
>       .. use the data any damn way you want ..
> 
> and we should probably aim to prefer that pattern over a lot of our
> traditional memory barriers.

I couldn't agree more!

RCU made a similar move from open-coding smp_read_barrier_depends()
to using rcu_dereference() many years ago, and that change made RCU
code -much- easier to read and understand.  I believe that moving
from smp_mb(), smp_rmb(), and smp_wmb() to smp_store_release() and
smp_load_acquire() will provide similar maintainability benefits.
Furthermore, when the current code uses smp_mb(), smp_store_release() and
smp_load_acquire() generate faster code on most architectures.

							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