From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Josh Triplett <josh@joshtriplett.org>
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,
Linux-Arch <linux-arch@vger.kernel.org>,
Ingo Molnar <mingo@redhat.com>, Oleg Nesterov <oleg@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH v5 tip/core/locking 6/7] locking: Add an smp_mb__after_unlock_lock() for UNLOCK+LOCK barrier
Date: Tue, 10 Dec 2013 10:53:57 -0800 [thread overview]
Message-ID: <20131210185357.GA7250@linux.vnet.ibm.com> (raw)
In-Reply-To: <20131210052641.GK4208@linux.vnet.ibm.com>
On Mon, Dec 09, 2013 at 09:26:41PM -0800, Paul E. McKenney wrote:
> On Mon, Dec 09, 2013 at 05:34:17PM -0800, Josh Triplett wrote:
> > On Mon, Dec 09, 2013 at 05:28:02PM -0800, Paul E. McKenney wrote:
> > > From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> > >
> > > The Linux kernel has traditionally required that an UNLOCK+LOCK pair
> > > act as a full memory barrier when either (1) that UNLOCK+LOCK pair
> > > was executed by the same CPU or task, or (2) the same lock variable
> > > was used for the UNLOCK and LOCK. It now seems likely that very few
> > > places in the kernel rely on this full-memory-barrier semantic, and
> > > with the advent of queued locks, providing this semantic either requires
> > > complex reasoning, or for some architectures, added overhead.
> > >
> > > This commit therefore adds a smp_mb__after_unlock_lock(), which may be
> > > placed after a LOCK primitive to restore the full-memory-barrier semantic.
> > > All definitions are currently no-ops, but will be upgraded for some
> > > architectures when queued locks arrive.
> > >
> > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > Cc: Linux-Arch <linux-arch@vger.kernel.org>
> > > Cc: Ingo Molnar <mingo@redhat.com>
> > > Cc: Peter Zijlstra <peterz@infradead.org>
> > > Cc: Oleg Nesterov <oleg@redhat.com>
> > > Cc: Linus Torvalds <torvalds@linux-foundation.org>
> >
> > It seems quite unfortunate that this isn't in some common location, and
> > then only overridden by architectures that need to do so.
>
> I was thinking that include/asm-generic/barrier.h was the place, but
> it is all-or-nothing, used by UP architectures, from what I can see.
> I figured that if there is such a common location, posting this patch
> might flush it out. I am not sure that this single definition is worth
> the creation of a common place -- or even this definition combined with
> smp_read_barrier_depends().
And of course the right place to put this is include/linux/spinlock.h,
the same place where smp_mb__before_spinlock() is defined. Exceptions
then go into the corresponding arch-specific spinlock.h files.
Much better that way, thank you for calling this out!
Thanx, Paul
> > More importantly: you document this earlier in the patch series than you
> > introduce it.
>
> Fair point, I reversed the order of those two patches.
>
> Thanx, Paul
next prev parent reply other threads:[~2013-12-10 18:54 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-10 1:27 [PATCH v5 tip/core/locking] Memory-barrier documentation updates + smp_mb__after_unlock_lock() Paul E. McKenney
2013-12-10 1:27 ` [PATCH v5 tip/core/locking 1/7] Documentation/memory-barriers.txt: Add needed ACCESS_ONCE() calls to memory-barriers.txt Paul E. McKenney
2013-12-10 1:27 ` [PATCH v5 tip/core/locking 2/7] Documentation/memory-barriers.txt: Add long atomic examples " Paul E. McKenney
2013-12-10 1:27 ` [PATCH v5 tip/core/locking 3/7] Documentation/memory-barriers.txt: Prohibit speculative writes Paul E. McKenney
2013-12-10 1:28 ` [PATCH v5 tip/core/locking 4/7] Documentation/memory-barriers.txt: Document ACCESS_ONCE() Paul E. McKenney
2013-12-10 1:28 ` [PATCH v5 tip/core/locking 5/7] Documentation/memory-barriers.txt: Downgrade UNLOCK+LOCK Paul E. McKenney
2013-12-10 1:32 ` Josh Triplett
2013-12-10 5:19 ` Paul E. McKenney
2013-12-10 13:14 ` Peter Zijlstra
2013-12-10 17:12 ` Paul E. McKenney
2013-12-10 17:25 ` Peter Zijlstra
2013-12-10 17:43 ` Josh Triplett
2013-12-10 18:05 ` Paul E. McKenney
2013-12-10 17:49 ` Paul E. McKenney
2013-12-10 17:43 ` Peter Zijlstra
2013-12-10 18:49 ` Paul E. McKenney
2013-12-10 16:44 ` Oleg Nesterov
2013-12-10 17:15 ` Paul E. McKenney
2013-12-10 17:35 ` Oleg Nesterov
2013-12-10 1:28 ` [PATCH v5 tip/core/locking 6/7] locking: Add an smp_mb__after_unlock_lock() for UNLOCK+LOCK barrier Paul E. McKenney
2013-12-10 1:34 ` Josh Triplett
2013-12-10 5:26 ` Paul E. McKenney
2013-12-10 18:53 ` Paul E. McKenney [this message]
2013-12-10 12:37 ` Peter Zijlstra
2013-12-10 17:17 ` Paul E. McKenney
2013-12-10 17:45 ` Josh Triplett
2013-12-10 20:11 ` Paul E. McKenney
2013-12-10 17:04 ` Oleg Nesterov
2013-12-10 17:18 ` Paul E. McKenney
2013-12-10 17:32 ` Oleg Nesterov
2013-12-10 1:28 ` [PATCH v5 tip/core/locking 7/7] rcu: Apply smp_mb__after_unlock_lock() to preserve grace periods Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131210185357.GA7250@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=darren@dvhart.com \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=josh@joshtriplett.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=niv@us.ibm.com \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sbw@mit.edu \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.