aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-12-09 22:59:22 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-09 22:59:22 -0500
commit9c37f95936b6c169e89733747504879b06e77c24 (patch)
tree9d03d0c8f8b716d7d232975ca6e89f0f33cd1602 /arch/x86
parenta0e4467726cd26bacb16f13d207ffcfa82ffc07d (diff)
parent78bff1c8684fb94f1ae7283688f90188b53fc433 (diff)
Merge branch 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking tree changes from Ingo Molnar: "Two changes: a documentation update and a ticket locks live lock fix" * 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/ticketlock: Fix spin_unlock_wait() livelock locking/lglocks: Add documentation of current lglocks implementation
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/spinlock.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h
index 9295016485c9..a4efe477ceab 100644
--- a/arch/x86/include/asm/spinlock.h
+++ b/arch/x86/include/asm/spinlock.h
@@ -183,8 +183,20 @@ static __always_inline void arch_spin_lock_flags(arch_spinlock_t *lock,
183 183
184static inline void arch_spin_unlock_wait(arch_spinlock_t *lock) 184static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
185{ 185{
186 while (arch_spin_is_locked(lock)) 186 __ticket_t head = ACCESS_ONCE(lock->tickets.head);
187
188 for (;;) {
189 struct __raw_tickets tmp = ACCESS_ONCE(lock->tickets);
190 /*
191 * We need to check "unlocked" in a loop, tmp.head == head
192 * can be false positive because of overflow.
193 */
194 if (tmp.head == (tmp.tail & ~TICKET_SLOWPATH_FLAG) ||
195 tmp.head != head)
196 break;
197
187 cpu_relax(); 198 cpu_relax();
199 }
188} 200}
189 201
190/* 202/*