Lines Matching defs:lock

32  * deterministic lock granting behavior, so that slocks and xlocks are
35 * Priority propagation will not generally raise the priority of lock holders,
51 #include <sys/lock.h>
74 PMC_SOFT_DECLARE( , , lock, failed);
114 * Returns true if an exclusive lock is recursed. It assumes
115 * curthread currently has an exclusive lock.
120 static void assert_sx(struct lock_object *lock, int what);
122 static void db_show_sx(struct lock_object *lock);
124 static void lock_sx(struct lock_object *lock, int how);
126 static int owner_sx(struct lock_object *lock, struct thread **owner);
128 static int unlock_sx(struct lock_object *lock);
149 assert_sx(struct lock_object *lock, int what)
152 sx_assert((struct sx *)lock, what);
156 lock_sx(struct lock_object *lock, int how)
160 sx = (struct sx *)lock;
168 unlock_sx(struct lock_object *lock)
172 sx = (struct sx *)lock;
185 owner_sx(struct lock_object *lock, struct thread **owner)
187 struct sx *sx = (struct sx *)lock;
237 KASSERT(sx->sx_lock == SX_LOCK_UNLOCKED, ("sx lock still held"));
238 KASSERT(sx->sx_recurse == 0, ("sx lock still recursed"));
388 * Try to do a non-blocking upgrade from a shared lock to an exclusive lock.
389 * This will only succeed if this thread holds a single shared lock.
406 * Try to switch from one shared lock to an exclusive lock. We need
408 * we will wake up the exclusive waiters when we drop the lock.
423 * Downgrade an unrecursed exclusive lock into a single shared lock.
439 panic("downgrade of a recursed lock");
445 * Try to switch from an exclusive lock with no shared waiters
447 * exclusive waiters, we don't need to lock the sleep queue so
449 * that fails we grab the sleepq lock to keep the flags from
452 * We have to lock the sleep queue if there are shared waiters
471 * shared lock. If there are any shared waiters, wake them up.
519 /* If we already hold an exclusive lock, then recurse. */
532 CTR5(KTR_LOCK, "%s: %s contested (lock=%p) at %s:%d", __func__,
540 PMC_SOFT_CALL( , , lock, failed);
546 * If the lock is write locked and the owner is
548 * running or the state of the lock changes.
597 * If the lock was released while spinning on the
598 * sleep queue chain lock, try again.
607 * The current lock owner might have started executing
608 * on another CPU (or the lock could have changed
610 * chain lock. If so, drop the sleep queue lock and try
624 * If an exclusive lock was released with both shared
626 * woken up and acquired the lock yet, sx_lock will be
663 * lock and the exclusive waiters flag is set, we have
727 /* If the lock is recursed, then unrecurse one level. */
811 * If no other thread has an exclusive lock then try to bump up
814 * shared lock loop back and retry.
830 PMC_SOFT_CALL( , , lock, failed);
838 * the owner stops running or the state of the lock
863 * Some other thread already has an exclusive lock, so
870 * The lock could have been released while we spun.
881 * the owner stops running or the state of the lock
896 * fail to set it drop the sleep queue lock and loop
911 * Since we have been unable to acquire the shared lock,
977 * holds a shared lock.
983 * See if there is more than one shared lock held. If
1000 * If there aren't any waiters for an exclusive lock,
1026 * Note that the state of the lock could have changed,
1081 * If some other thread has an exclusive lock or we
1082 * have one and are asserting a shared lock, fail.
1083 * Also, if no one has a lock at all, fail.
1123 * If we hold an exclusve lock fail. We can't
1124 * reliably check to see if we hold a shared lock or
1133 panic("Unknown sx lock assertion: %d @ %s:%d", what, file,
1141 db_show_sx(struct lock_object *lock)
1146 sx = (struct sx *)lock;
1183 * blocked on an sx lock. If so, output some details and return true.
1184 * If the lock has an exclusive owner, return that in *ownerp.
1192 * Check to see if this thread is blocked on an sx lock.
1193 * First, we check the lock class. If that is ok, then we
1194 * compare the lock name against the wait message.
1201 /* We think we have an sx lock, so output some details. */