/* * We can't use GEN_BINARY_RMWcc() inside an if() stmt because asm goto * and CONFIG_PROFILE_ALL_BRANCHES=y results in a label inside a * statement expression, which GCC doesn't like.
*/
val = GEN_BINARY_RMWcc(LOCK_PREFIX "btsl", lock->val.counter, c, "I", _Q_PENDING_OFFSET) * _Q_PENDING_VAL;
val |= atomic_read(&lock->val) & ~_Q_PENDING_MASK;
#ifdef CONFIG_PARAVIRT /* * virt_spin_lock_key - disables by default the virt_spin_lock() hijack. * * Native (and PV wanting native due to vCPU pinning) should keep this key * disabled. Native does not touch the key. * * When in a guest then native_pv_lock_init() enables the key first and * KVM/XEN might conditionally disable it later in the boot process again.
*/
DECLARE_STATIC_KEY_FALSE(virt_spin_lock_key);
/* * Shortcut for the queued_spin_lock_slowpath() function that allows * virt to hijack it. * * Returns: * true - lock has been negotiated, all done; * false - queued_spin_lock_slowpath() will do its thing.
*/ #define virt_spin_lock virt_spin_lock staticinlinebool virt_spin_lock(struct qspinlock *lock)
{ int val;
if (!static_branch_likely(&virt_spin_lock_key)) returnfalse;
/* * On hypervisors without PARAVIRT_SPINLOCKS support we fall * back to a Test-and-Set spinlock, because fair locks have * horrible lock 'holder' preemption issues.
*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.