From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Peter Zijlstra <peterz@infradead.org>,
Will Deacon <will.deacon@arm.com>,
Paul McKenney <paulmck@linux.vnet.ibm.com>,
Boqun Feng <boqun.feng@gmail.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
vgupta@synopsys.com, rkuo@codeaurora.org, james.hogan@imgtec.com,
jejb@parisc-linux.org, davem@davemloft.net,
cmetcalf@mellanox.com, Parisc List <linux-parisc@vger.kernel.org>
Subject: Re: [RFC][PATCH] atomic: Fix atomic_set_release() for 'funny' architectures
Date: Fri, 09 Jun 2017 11:58:46 -0700 [thread overview]
Message-ID: <1497034726.3510.7.camel@HansenPartnership.com> (raw)
In-Reply-To: <20170609111305.bn4ca4uscbp6pgxn@hirez.programming.kicks-ass.net>
[adding parisc list]
On Fri, 2017-06-09 at 13:13 +0200, Peter Zijlstra wrote:
> On Fri, Jun 09, 2017 at 01:05:06PM +0200, Peter Zijlstra wrote:
>
> > The spinlock based atomics should be SC, that is, none of them
> > appear to
> > place extra barriers in atomic_cmpxchg() or any of the other SC
> > atomic
> > primitives and therefore seem to rely on their spinlock
> > implementation
> > being SC (I did not fully validate all that).
>
> So I did see that ARC and PARISC have 'superfluous' smp_mb() calls
> around their spinlock implementation.
>
> That is, for spinlock semantics you only need one _after_ lock and
> one _before_ unlock. But the atomic stuff relies on being SC and thus
> would need one before and after both lock and unlock.
Actually, for us that's not true. You are correct in the above for
safety but not for performance: If we remove the safety unnecessary
barriers, it can elongate our critical sections (the spinlock can move
up in the code stream and the spin unlock can move down) which leads to
performance regressions because we end up holding locks longer than we
need (we also have a lot of hot locks).
> Now, afaict PARISC doesn't even have memory barriers (it uses
> asm-generic/barrier.h) so that's a bit of a puzzle.
We disable relaxed ordering on our architecture which means the CPU
issue stream must match the instruction stream. We've debated turning
on relaxed ordering, but decided it was more hassle than it's worth.
James
> But ARC could probably optimize (if they still care about that
> hardware) by pulling out those barriers and putting it in the atomic
> implementation.
>
next prev parent reply other threads:[~2017-06-09 18:58 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-09 9:24 [RFC][PATCH]: documentation,atomic: Add a new atomic_t document Peter Zijlstra
2017-06-09 11:05 ` [RFC][PATCH] atomic: Fix atomic_set_release() for 'funny' architectures Peter Zijlstra
2017-06-09 11:13 ` Peter Zijlstra
2017-06-09 17:28 ` Vineet Gupta
2017-06-09 18:49 ` Peter Zijlstra
2017-06-09 18:58 ` James Bottomley [this message]
2017-06-09 14:03 ` Chris Metcalf
2017-08-10 12:10 ` [tip:locking/core] locking/atomic: " tip-bot for Peter Zijlstra
2017-06-09 15:44 ` [RFC][PATCH]: documentation,atomic: Add a new atomic_t document Will Deacon
2017-06-09 19:36 ` Peter Zijlstra
2017-06-11 13:56 ` Boqun Feng
2017-06-12 14:49 ` Peter Zijlstra
2017-06-13 6:39 ` Boqun Feng
2017-06-14 12:33 ` Will Deacon
2017-07-12 12:53 ` Boqun Feng
2017-07-12 13:08 ` Peter Zijlstra
2017-07-12 19:13 ` Paul E. McKenney
2017-07-26 11:53 ` [RFC][PATCH v3]: documentation,atomic: Add new documents Peter Zijlstra
2017-07-26 12:47 ` Boqun Feng
2017-07-31 9:05 ` Peter Zijlstra
2017-07-31 11:04 ` Boqun Feng
2017-07-31 17:43 ` Paul E. McKenney
2017-08-01 2:14 ` Boqun Feng
2017-08-01 9:01 ` Peter Zijlstra
2017-08-01 10:19 ` Will Deacon
2017-08-01 11:47 ` Peter Zijlstra
2017-08-01 12:17 ` Will Deacon
2017-08-01 12:52 ` Peter Zijlstra
2017-08-01 16:14 ` Paul E. McKenney
2017-08-01 16:42 ` Peter Zijlstra
2017-08-01 16:53 ` Will Deacon
2017-08-01 22:18 ` Paul E. McKenney
2017-08-02 8:46 ` Will Deacon
2017-08-01 18:37 ` Paul E. McKenney
2017-08-02 9:45 ` Will Deacon
2017-08-02 16:17 ` Paul E. McKenney
2017-08-03 14:05 ` Boqun Feng
2017-08-03 14:55 ` Paul E. McKenney
2017-08-03 16:12 ` Will Deacon
2017-08-03 16:58 ` Paul E. McKenney
2017-08-01 13:35 ` Paul E. McKenney
2017-07-26 16:28 ` Randy Dunlap
2017-06-09 18:15 ` [RFC][PATCH]: documentation,atomic: Add a new atomic_t document Randy Dunlap
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=1497034726.3510.7.camel@HansenPartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=boqun.feng@gmail.com \
--cc=cmetcalf@mellanox.com \
--cc=davem@davemloft.net \
--cc=james.hogan@imgtec.com \
--cc=jejb@parisc-linux.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rkuo@codeaurora.org \
--cc=tglx@linutronix.de \
--cc=vgupta@synopsys.com \
--cc=will.deacon@arm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox