From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751999Ab3LJBcw (ORCPT ); Mon, 9 Dec 2013 20:32:52 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:32780 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751157Ab3LJBcr (ORCPT ); Mon, 9 Dec 2013 20:32:47 -0500 X-Originating-IP: 173.246.103.110 Date: Mon, 9 Dec 2013 17:32:31 -0800 From: Josh Triplett To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, laijs@cn.fujitsu.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, niv@us.ibm.com, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, darren@dvhart.com, fweisbec@gmail.com, sbw@mit.edu, Ingo Molnar , Oleg Nesterov , Linus Torvalds , Will Deacon , Tim Chen , Waiman Long , Andrea Arcangeli , Andi Kleen , Michel Lespinasse , Davidlohr Bueso , Rik van Riel , Peter Hurley , "H. Peter Anvin" , Arnd Bergmann , Benjamin Herrenschmidt Subject: Re: [PATCH v5 tip/core/locking 5/7] Documentation/memory-barriers.txt: Downgrade UNLOCK+LOCK Message-ID: <20131210013231.GA24138@jtriplet-mobl1> References: <20131210012738.GA24317@linux.vnet.ibm.com> <1386638883-25379-1-git-send-email-paulmck@linux.vnet.ibm.com> <1386638883-25379-5-git-send-email-paulmck@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1386638883-25379-5-git-send-email-paulmck@linux.vnet.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 09, 2013 at 05:28:01PM -0800, Paul E. McKenney wrote: > From: "Paul E. McKenney" > > Historically, an UNLOCK+LOCK pair executed by one CPU, by one task, > or on a given lock variable has implied a full memory barrier. In a > recent LKML thread, the wisdom of this historical approach was called > into question: http://www.spinics.net/lists/linux-mm/msg65653.html, > in part due to the memory-order complexities of low-handoff-overhead > queued locks on x86 systems. > > This patch therefore removes this guarantee from the documentation, and > further documents how to restore it via a new smp_mb__after_unlock_lock() > primitive. > > Signed-off-by: Paul E. McKenney > Cc: Ingo Molnar > Cc: Peter Zijlstra > Cc: Oleg Nesterov > Cc: Linus Torvalds > Cc: Will Deacon > Cc: Tim Chen > Cc: Andrew Morton > Cc: Thomas Gleixner > Cc: Waiman Long > Cc: Andrea Arcangeli > Cc: Andi Kleen > Cc: Michel Lespinasse > Cc: Davidlohr Bueso > Cc: Rik van Riel > Cc: Peter Hurley > Cc: "H. Peter Anvin" > Cc: Arnd Bergmann > Cc: Benjamin Herrenschmidt > --- > Documentation/memory-barriers.txt | 51 +++++++++++++++++++++++++++++++++------ > 1 file changed, 44 insertions(+), 7 deletions(-) > > diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt > index a0763db314ff..efb791d33e5a 100644 > --- a/Documentation/memory-barriers.txt > +++ b/Documentation/memory-barriers.txt > @@ -1626,7 +1626,10 @@ for each construct. These operations all imply certain barriers: > operation has completed. > > Memory operations issued before the LOCK may be completed after the LOCK > - operation has completed. > + operation has completed. An smp_mb__before_spinlock(), combined > + with a following LOCK, acts as an smp_wmb(). Note the "w", > + this is smp_wmb(), not smp_mb(). The smp_mb__before_spinlock() > + primitive is free on many architectures. Gah. That seems highly error-prone; why isn't that "smp_wmb__before_spinlock()"? - Josh Triplett