Skip to content

Commit 4badad3

Browse files
Peter Zijlstraingomolnar
authored andcommitted
locking/mutex: Disable optimistic spinning on some architectures
The optimistic spin code assumes regular stores and cmpxchg() play nice; this is found to not be true for at least: parisc, sparc32, tile32, metag-lock1, arc-!llsc and hexagon. There is further wreckage, but this in particular seemed easy to trigger, so blacklist this. Opt in for known good archs. Signed-off-by: Peter Zijlstra <peterz@infradead.org> Reported-by: Mikulas Patocka <mpatocka@redhat.com> Cc: David Miller <davem@davemloft.net> Cc: Chris Metcalf <cmetcalf@tilera.com> Cc: James Bottomley <James.Bottomley@hansenpartnership.com> Cc: Vineet Gupta <vgupta@synopsys.com> Cc: Jason Low <jason.low2@hp.com> Cc: Waiman Long <waiman.long@hp.com> Cc: "James E.J. Bottomley" <jejb@parisc-linux.org> Cc: Paul McKenney <paulmck@linux.vnet.ibm.com> Cc: John David Anglin <dave.anglin@bell.net> Cc: James Hogan <james.hogan@imgtec.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Davidlohr Bueso <davidlohr@hp.com> Cc: stable@vger.kernel.org Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Will Deacon <will.deacon@arm.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: sparclinux@vger.kernel.org Link: http://lkml.kernel.org/r/20140606175316.GV13930@laptop.programming.kicks-ass.net Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent ce069fc commit 4badad3

6 files changed

Lines changed: 9 additions & 1 deletion

File tree

‎arch/arm/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ config ARM
66
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
77
select ARCH_HAVE_CUSTOM_GPIO_H
88
select ARCH_MIGHT_HAVE_PC_PARPORT
9+
select ARCH_SUPPORTS_ATOMIC_RMW
910
select ARCH_USE_BUILTIN_BSWAP
1011
select ARCH_USE_CMPXCHG_LOCKREF
1112
select ARCH_WANT_IPC_PARSE_VERSION

‎arch/arm64/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ config ARM64
44
select ARCH_HAS_OPP
55
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
66
select ARCH_USE_CMPXCHG_LOCKREF
7+
select ARCH_SUPPORTS_ATOMIC_RMW
78
select ARCH_WANT_OPTIONAL_GPIOLIB
89
select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
910
select ARCH_WANT_FRAME_POINTERS

‎arch/powerpc/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ config PPC
145145
select HAVE_IRQ_EXIT_ON_IRQ_STACK
146146
select ARCH_USE_CMPXCHG_LOCKREF if PPC64
147147
select HAVE_ARCH_AUDITSYSCALL
148+
select ARCH_SUPPORTS_ATOMIC_RMW
148149

149150
config GENERIC_CSUM
150151
def_bool CPU_LITTLE_ENDIAN

‎arch/sparc/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ config SPARC64
7878
select HAVE_C_RECORDMCOUNT
7979
select NO_BOOTMEM
8080
select HAVE_ARCH_AUDITSYSCALL
81+
select ARCH_SUPPORTS_ATOMIC_RMW
8182

8283
config ARCH_DEFCONFIG
8384
string

‎arch/x86/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ config X86
131131
select HAVE_CC_STACKPROTECTOR
132132
select GENERIC_CPU_AUTOPROBE
133133
select HAVE_ARCH_AUDITSYSCALL
134+
select ARCH_SUPPORTS_ATOMIC_RMW
134135

135136
config INSTRUCTION_DECODER
136137
def_bool y

‎kernel/Kconfig.locks‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,12 @@ config INLINE_WRITE_UNLOCK_IRQRESTORE
220220

221221
endif
222222

223+
config ARCH_SUPPORTS_ATOMIC_RMW
224+
bool
225+
223226
config MUTEX_SPIN_ON_OWNER
224227
def_bool y
225-
depends on SMP && !DEBUG_MUTEXES
228+
depends on SMP && !DEBUG_MUTEXES && ARCH_SUPPORTS_ATOMIC_RMW
226229

227230
config ARCH_USE_QUEUE_RWLOCK
228231
bool

0 commit comments

Comments
 (0)