Commit 2aa79af6 authored by Peter Zijlstra (Intel)'s avatar Peter Zijlstra (Intel) Committed by Ingo Molnar
Browse files

locking/qspinlock: Revert to test-and-set on hypervisors

When we detect a hypervisor (!paravirt, see qspinlock paravirt support
patches), revert to a simple test-and-set lock to avoid the horrors
of queue preemption.
Signed-off-by: default avatarPeter Zijlstra (Intel) <>
Signed-off-by: default avatarWaiman Long <>
Signed-off-by: default avatarPeter Zijlstra (Intel) <>
Cc: Andrew Morton <>
Cc: Boris Ostrovsky <>
Cc: Borislav Petkov <>
Cc: Daniel J Blueman <>
Cc: David Vrabel <>
Cc: Douglas Hatch <>
Cc: H. Peter Anvin <>
Cc: Konrad Rzeszutek Wilk <>
Cc: Linus Torvalds <>
Cc: Oleg Nesterov <>
Cc: Paolo Bonzini <>
Cc: Paul E. McKenney <>
Cc: Peter Zijlstra <>
Cc: Raghavendra K T <>
Cc: Rik van Riel <>
Cc: Scott J Norton <>
Cc: Thomas Gleixner <>

Signed-off-by: default avatarIngo Molnar <>
parent 2c83e8e9
#ifndef _ASM_X86_QSPINLOCK_H
#define _ASM_X86_QSPINLOCK_H
#include <asm/cpufeature.h>
#include <asm-generic/qspinlock_types.h>
#define queued_spin_unlock queued_spin_unlock
......@@ -15,6 +16,19 @@ static inline void queued_spin_unlock(struct qspinlock *lock)
smp_store_release((u8 *)lock, 0);
#define virt_queued_spin_lock virt_queued_spin_lock
static inline bool virt_queued_spin_lock(struct qspinlock *lock)
if (!static_cpu_has(X86_FEATURE_HYPERVISOR))
return false;
while (atomic_cmpxchg(&lock->val, 0, _Q_LOCKED_VAL) != 0)
return true;
#include <asm-generic/qspinlock.h>
#endif /* _ASM_X86_QSPINLOCK_H */
......@@ -111,6 +111,13 @@ static inline void queued_spin_unlock_wait(struct qspinlock *lock)
#ifndef virt_queued_spin_lock
static __always_inline bool virt_queued_spin_lock(struct qspinlock *lock)
return false;
* Initializier
......@@ -249,6 +249,9 @@ void queued_spin_lock_slowpath(struct qspinlock *lock, u32 val)
if (virt_queued_spin_lock(lock))
* wait for in-progress pending->locked hand-overs
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment