public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Davidlohr Bueso <davidlohr@hp.com>,
	mingo@kernel.org, mpatocka@redhat.com,
	torvalds@linux-foundation.org, jason.low2@hp.com,
	waiman.long@hp.com, jejb@parisc-linux.org,
	paulmck@linux.vnet.ibm.com, dave.anglin@bell.net, aswin@hp.com,
	linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org,
	davem@davemloft.net, james.hogan@imgtec.com, cmetcalf@tilera.com,
	vgupta@synopsys.com
Subject: Re: [PATCH 2/2] locking/rwsem: Disable optimistic spinning for PA-RISC
Date: Fri, 6 Jun 2014 19:11:45 +0200	[thread overview]
Message-ID: <20140606171145.GU13930@laptop.programming.kicks-ass.net> (raw)
In-Reply-To: <1402070987.2207.75.camel@dabdike.int.hansenpartnership.com>

On Fri, Jun 06, 2014 at 09:09:47AM -0700, James Bottomley wrote:
> On Fri, 2014-06-06 at 08:55 -0700, Davidlohr Bueso wrote:
> > PA-RISC's cmpxchg is not save against normal stores and the code used
> > for optimistic spinning is known broken because of this.
> 
> What about all the other identified architectures?  The problem is that
> unless you can do an atomic Read Modify Write on your architecture, you
> have to implement our exchange primitives with locking, and that makes
> you unsafe against stores  We happen to be the architecture that
> detected this, but I thought we agreed sparc32, metag, tile32, arc and
> possibly hexagon have this problem.
> 
> Rather than naming all the failing architectures, we probably want an 
> 
> ARCH_NO_ATOMIC_RMW

The thing is, all these archs are broken beyond this particular problem,
Mikulas Patocka found a number of other spots.

In any case, sure I can exclude more. Although ideally someone goes do
that __atomic sparse thing to flush out all this.

---
Subject: locking, mutex: Disable optimistic spinning on !RMW archs

For some archs a regular store does not play nice with cmpxchg(), the
optimistic spinning code (and various other places not caught by this)
break this assumption and make things go boom.

Until something better is found, disable optimistic spinning for these
archs.

Cc: James.Bottomley@HansenPartnership.com
Cc: davem@davemloft.net
Cc: james.hogan@imgtec.com
Cc: cmetcalf@tilera.com
Cc: vgupta@synopsys.com
Reported-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
---
 kernel/Kconfig.locks | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/Kconfig.locks b/kernel/Kconfig.locks
index d2b32ac27a39..b9c132c48bf1 100644
--- a/kernel/Kconfig.locks
+++ b/kernel/Kconfig.locks
@@ -220,6 +220,10 @@ config INLINE_WRITE_UNLOCK_IRQRESTORE
 
 endif
 
+config ARCH_NO_ATOMIC_RMW
+	def_bool y
+	depends on PARISC || SPARC32 || METAG_ATOMICITY_LOCK1 || (TILE && !TILEGX) || (ARC && !ARC_HAS_LLSC)
+
 config MUTEX_SPIN_ON_OWNER
 	def_bool y
-	depends on SMP && !DEBUG_MUTEXES
+	depends on SMP && !DEBUG_MUTEXES && !ARCH_NO_ATOMIC_RMW

  reply	other threads:[~2014-06-06 17:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-06 15:55 [PATCH 0/2] locking/rwsem: disable optimistic spinning for PA-RISC Davidlohr Bueso
2014-06-06 15:55 ` [PATCH 1/2] locking/rwsem: Add CONFIG_RWSEM_SPIN_ON_OWNER Davidlohr Bueso
2014-06-06 17:13   ` Jason Low
2014-06-06 18:12     ` Davidlohr Bueso
2014-06-06 18:48       ` Davidlohr Bueso
2014-06-06 19:08         ` Jason Low
2014-06-06 19:20           ` Davidlohr Bueso
2014-06-06 15:55 ` [PATCH 2/2] locking/rwsem: Disable optimistic spinning for PA-RISC Davidlohr Bueso
2014-06-06 16:09   ` James Bottomley
2014-06-06 17:11     ` Peter Zijlstra [this message]
2014-06-06 17:19       ` Chris Metcalf
2014-06-06 17:22       ` Linus Torvalds
2014-06-06 17:53         ` Peter Zijlstra
2014-06-06 17:57           ` James Bottomley
2014-06-06 17:58             ` James Bottomley
2014-06-06 18:01             ` Peter Zijlstra
2014-07-16 19:24           ` [tip:locking/urgent] locking/mutex: Disable optimistic spinning on some architectures tip-bot for Peter Zijlstra
2014-07-17 11:51             ` Christian Borntraeger
2014-07-17 11:58               ` Christian Borntraeger
2014-07-18  3:07             ` Davidlohr Bueso
2014-07-18  3:10               ` Davidlohr Bueso

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=20140606171145.GU13930@laptop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=aswin@hp.com \
    --cc=cmetcalf@tilera.com \
    --cc=dave.anglin@bell.net \
    --cc=davem@davemloft.net \
    --cc=davidlohr@hp.com \
    --cc=james.hogan@imgtec.com \
    --cc=jason.low2@hp.com \
    --cc=jejb@parisc-linux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=torvalds@linux-foundation.org \
    --cc=vgupta@synopsys.com \
    --cc=waiman.long@hp.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