Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking fixes from Ingo Molnar: "Spinlock performance regression fix, plus documentation fixes" * 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: locking/static_keys: Fix up the static keys documentation locking/qspinlock/x86: Only emit the test-and-set fallback when building guest support locking/qspinlock/x86: Fix performance regression under unaccelerated VMs locking/static_keys: Fix a silly typo
This commit is contained in:
@@ -39,18 +39,27 @@ static inline void queued_spin_unlock(struct qspinlock *lock)
|
||||
}
|
||||
#endif
|
||||
|
||||
#define virt_queued_spin_lock virt_queued_spin_lock
|
||||
|
||||
static inline bool virt_queued_spin_lock(struct qspinlock *lock)
|
||||
#ifdef CONFIG_PARAVIRT
|
||||
#define virt_spin_lock virt_spin_lock
|
||||
static inline bool virt_spin_lock(struct qspinlock *lock)
|
||||
{
|
||||
if (!static_cpu_has(X86_FEATURE_HYPERVISOR))
|
||||
return false;
|
||||
|
||||
while (atomic_cmpxchg(&lock->val, 0, _Q_LOCKED_VAL) != 0)
|
||||
cpu_relax();
|
||||
/*
|
||||
* On hypervisors without PARAVIRT_SPINLOCKS support we fall
|
||||
* back to a Test-and-Set spinlock, because fair locks have
|
||||
* horrible lock 'holder' preemption issues.
|
||||
*/
|
||||
|
||||
do {
|
||||
while (atomic_read(&lock->val) != 0)
|
||||
cpu_relax();
|
||||
} while (atomic_cmpxchg(&lock->val, 0, _Q_LOCKED_VAL) != 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif /* CONFIG_PARAVIRT */
|
||||
|
||||
#include <asm-generic/qspinlock.h>
|
||||
|
||||
|
Reference in New Issue
Block a user