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]
Message-ID: <20131125094223.GV10022@twins.programming.kicks-ass.net>
Date:	Mon, 25 Nov 2013 10:42:23 +0100
From:	Peter Zijlstra <peterz@...radead.org>
To:	Peter Hurley <peter@...leysoftware.com>
Cc:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	linux-kernel@...r.kernel.org, Will Deacon <will.deacon@....com>,
	Tim Chen <tim.c.chen@...ux.intel.com>,
	Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	linux-arch@...r.kernel.org,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Waiman Long <waiman.long@...com>,
	Andrea Arcangeli <aarcange@...hat.com>,
	Alex Shi <alex.shi@...aro.org>,
	Andi Kleen <andi@...stfloor.org>,
	Michel Lespinasse <walken@...gle.com>,
	Davidlohr Bueso <davidlohr.bueso@...com>,
	Matthew R Wilcox <matthew.r.wilcox@...el.com>,
	Dave Hansen <dave.hansen@...el.com>,
	Rik van Riel <riel@...hat.com>,
	Raghavendra K T <raghavendra.kt@...ux.vnet.ibm.com>,
	George Spelvin <linux@...izon.com>,
	"H. Peter Anvin" <hpa@...or.com>, Arnd Bergmann <arnd@...db.de>,
	Aswin Chandramouleeswaran <aswin@...com>,
	Scott J Norton <scott.norton@...com>,
	"Figo.zhang" <figo1802@...il.com>
Subject: Re: [RFC] Control dependencies

On Fri, Nov 22, 2013 at 12:59:41PM -0500, Peter Hurley wrote:
> On 11/22/2013 08:46 AM, Peter Zijlstra wrote:
> >How about the below version?
> >
> >---
> >--- a/kernel/events/ring_buffer.c
> >+++ b/kernel/events/ring_buffer.c
> >@@ -61,19 +61,20 @@ static void perf_output_put_handle(struc
> >  	 *
> >  	 *   kernel				user
> >  	 *
> >-	 *   READ ->data_tail			READ ->data_head
> >-	 *   smp_mb()	(A)			smp_rmb()	(C)
> >-	 *   WRITE $data			READ $data
> >-	 *   smp_wmb()	(B)			smp_mb()	(D)
> >-	 *   STORE ->data_head			WRITE ->data_tail
> >+	 *   if (LOAD ->data_tail) {		LOAD ->data_head
> >+	 *			(A)		smp_rmb()	(C)
> >+	 *	STORE $data			LOAD $data
> >+	 *	smp_wmb()	(B)		smp_mb()	(D)
> >+	 *	STORE ->data_head		STORE ->data_tail
> 
> 
> I wasn't subscribed to linux-arch so missed the smp_store_release()
> outcome, if there was one.
> 
> Are (B) and (D) still slated for changing to STORE.rel semantics,
> aka smp_store_release()?

The earlier proposal would have A and C be smp_load_acquire() and B and
D be smp_store_release().

> I realize that, for the perf ring buffer, (D) is in userspace but
> I'm also interested in non-perf situations where (D) would be in the
> kernel.

So we're still debating the exact semantics of smp_store_release(), it
now looks like it needs a heavier memory barrier than previously
thought. In which case using it wouldn't make sense for me anymore.

Note that C and D are in userspace and not in any hot path (usually)
They're only issued once to read an entire buffer backlog at once, so I
don't really care about them all that much.

A and B otoh are in kernel space and are issued for every single event
written, so I'm interested to get them as cheaply as possible.

With this proposed patch, we remove a full barrier, with the earlier
smp_load_acquire() / smp_store_release() patches we would only
downgrade the full barrier to an acquire barrier, which is still more
than no barrier at all.

And now it looks like the smp_store_release() would actually upgrade the
wmb to a full barrier on some systems at least.



--
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