class OwnedWaitQueue
Defined at line 55 of file ../../zircon/kernel/include/kernel/owned_wait_queue.h
Owned wait queues are an extension of wait queues which adds the concept of
ownership for use when profile inheritance semantics are needed.
An owned wait queue maintains an unmanaged pointer to a Thread in order to
track who owns it at any point in time. In addition, it contains node state
which can be used by the owning thread in order to track the wait queues that
the thread is currently an owner of. This also makes use of unmanaged
pointer.
It should be an error for any thread to destruct while it owns an
OwnedWaitQueue. Likewise, it should be an error for any wait queue to
destruct while it has an owner. These invariants are enforced in the
destructor for OwnedWaitQueue and Thread. This enforcement is considered
to be the reasoning why holding unmanaged pointers is considered to be safe.
Public Members
static const uint32_t kOwnedMagic
Public Methods
void ~OwnedWaitQueue ()
Defined at line 18 of file ../../zircon/kernel/kernel/owned_wait_queue.cc
void DisownAllQueues (Thread * t)
Release ownership of all wait queues currently owned by |t| and update
bookkeeping as appropriate. This is meant to be called from the thread
itself and therefore it is assumed that the thread in question is not
blocked on any other wait queues.
Defined at line 20 of file ../../zircon/kernel/kernel/owned_wait_queue.cc
SchedulerState::EffectiveProfile GetEffectiveProfile ()
Get the effective profile of an OwnedWaitQueue. The effective profile of an
OwnedWaitQueue is the composition of the effective profiles of all the
threads currently waiting in that queue. As such, the effective profile may
change as threads are added to or removed from the queue or when the
effective profile of any thread in the queue changes, either due to base
profile changes or transitive propagation of upstream profile changes from
owned wait queues that they own.
Defined at line 11 of file ../../zircon/kernel/kernel/owned_wait_queue.cc
void SetThreadBaseProfileAndPropagate (Thread & thread, const SchedulerState::BaseProfile & profile)
Change a thread's base profile and deal with profile propagation side effects.
Defined at line 57 of file ../../zircon/kernel/kernel/owned_wait_queue.cc
zx_status_t AssignOwner (Thread * new_owner)
Assign ownership of this wait queue to |new_owner|, or explicitly release
ownership if |new_owner| is nullptr. No change is made to ownership if it
would result in a cycle in the inheritance graph.
Note, if the new owner exists, but is dead or dying, it will not be
permitted to become the new owner of the wait_queue. Any existing owner
will be replaced with no owner in this situation.
Returns ZX_ERR_BAD_STATE if a cycle would have been produced, and ZX_OK
otherwise.
Defined at line 62 of file ../../zircon/kernel/kernel/owned_wait_queue.cc
zx_status_t AssignOwnerLocked (Thread * new_owner)
Returns ZX_ERR_SHOULD_WAIT if a back-off is required, and ZX_OK otherwise.
Defined at line 66 of file ../../zircon/kernel/kernel/owned_wait_queue.cc
void ResetOwnerIfNoWaiters ()
Defined at line 70 of file ../../zircon/kernel/kernel/owned_wait_queue.cc
zx_status_t BlockAndAssignOwner (const Deadline &deadline,Thread *new_owner,ResourceOwnershipresource_ownership,Interruptibleinterruptible)
Block the current thread on this wait queue, and re-assign ownership to
the specified thread (or remove ownership if new_owner is null). If
assigning new_owner would produce a cycle, the proposed owner is rejected
(and any existing owner is removed), but the current thread still blocks.
Note, if the new owner exists, but is dead or dying, it will not be
permitted to become the new owner of the wait_queue. Any existing owner
will be replaced with no owner in this situation.
Defined at line 74 of file ../../zircon/kernel/kernel/owned_wait_queue.cc
zx_status_t BlockAndAssignOwnerLocked (Thread *current_thread,const Deadline &deadline,const BAAOLockingDetails &details,ResourceOwnershipresource_ownership,Interruptibleinterruptible,ForceInheritanceforce_inheritance)
Defined at line 81 of file ../../zircon/kernel/kernel/owned_wait_queue.cc
bool TryLockForBAAOOperationLocked (Thread *current_thread,Thread *new_owner,BAAOLockingDetails &details_out)
Attempt to obtain all of the locks needed for a BAAO operation while
already holding this queue's lock. On success, the current thread's lock
will have been obtained in addition to any other locks in the PI chain
which are needed, and the details of the locking operation will be
returned. On failure, returns ktl::nullopt after dropping any locks which
had been obtained.
Defined at line 50 of file ../../zircon/kernel/kernel/owned_wait_queue.cc
WakeThreadsResult WakeThreads (uint32_t wake_count, IWakeRequeueHook & wake_hooks)
Wake the up to specified number of threads from the wait queue, removing
any current queue owner in the process.
Defined at line 90 of file ../../zircon/kernel/kernel/owned_wait_queue.cc
WakeThreadsResult WakeThreadAndAssignOwner (IWakeRequeueHook & wake_hooks)
Attempt to wake exactly one thread, and assign ownership of the queue to
the woken thread (if any).
Defined at line 97 of file ../../zircon/kernel/kernel/owned_wait_queue.cc
WakeThreadsResult WakeThreadsLocked (Thread::UnblockListthreads,IWakeRequeueHook &wake_hooks,WakeOptionoption,ForceInheritanceforce_inheritance)
Defined at line 24 of file ../../zircon/kernel/kernel/owned_wait_queue.cc
bool LockForWakeOperationOrBackoff (uint32_tmax_wake,IWakeRequeueHook &wake_hooks,Thread::UnblockList &unblock_list_out)
Obtain all of the locks needed for a WakeThreads operation.
Defined at line 33 of file ../../zircon/kernel/kernel/owned_wait_queue.cc
ktl::optional<Thread::UnblockList> LockForWakeOperationLocked (uint32_t max_wake, IWakeRequeueHook & wake_hooks)
Defined at line 40 of file ../../zircon/kernel/kernel/owned_wait_queue.cc
IWakeRequeueHook & default_wake_hooks ()
Defined at line 102 of file ../../zircon/kernel/include/kernel/owned_wait_queue.h
WakeThreadsResult WakeAndRequeue (OwnedWaitQueue &requeue_target,Thread *new_requeue_owner,uint32_twake_count,uint32_trequeue_count,IWakeRequeueHook &wake_hooks,IWakeRequeueHook &requeue_hooks,WakeOptionwake_option)
Defined at line 104 of file ../../zircon/kernel/kernel/owned_wait_queue.cc
void OwnedWaitQueue ()
Defined at line 128 of file ../../zircon/kernel/include/kernel/owned_wait_queue.h
void OwnedWaitQueue (const OwnedWaitQueue & )
No copy or move is permitted.
Defined at line 132 of file ../../zircon/kernel/include/kernel/owned_wait_queue.h
void OwnedWaitQueue (OwnedWaitQueue && )
No copy or move is permitted.
Defined at line 132 of file ../../zircon/kernel/include/kernel/owned_wait_queue.h
OwnedWaitQueue & operator= (const OwnedWaitQueue & )
No copy or move is permitted.
Defined at line 132 of file ../../zircon/kernel/include/kernel/owned_wait_queue.h
OwnedWaitQueue & operator= (OwnedWaitQueue && )
No copy or move is permitted.
Defined at line 132 of file ../../zircon/kernel/include/kernel/owned_wait_queue.h
ChainLock::Result LockPiChain (Thread & start)
Attempt to lock the rest of a PI chain, starting from the (already locked)
node given by |start|.
Defined at line 156 of file ../../zircon/kernel/include/kernel/owned_wait_queue.h
ChainLock::Result LockPiChain (WaitQueueBase & start)
Defined at line 161 of file ../../zircon/kernel/include/kernel/owned_wait_queue.h
Thread * owner ()
const accessor for the owner member.
Defined at line 167 of file ../../zircon/kernel/include/kernel/owned_wait_queue.h
void AssertNotOwned ()
Debug Assert wrapper which skips the thread analysis checks just to
assert that a specific queue is unowned. Used by FutexContext
Defined at line 171 of file ../../zircon/kernel/include/kernel/owned_wait_queue.h
void AssertSafeForPooling ()
Check invariants before returning to the pool.
Defined at line 195 of file ../../zircon/kernel/include/kernel/owned_wait_queue.h
SchedulerState::WaitQueueInheritedSchedulerState * inherited_scheduler_state_storage ()
Accessor used only by the scheduler's PiNodeAdapter to handle bookkeeping
during profile inheritance situations.
Defined at line 262 of file ../../zircon/kernel/include/kernel/owned_wait_queue.h
const SchedulerState::WaitQueueInheritedSchedulerState * inherited_scheduler_state_storage ()
Defined at line 267 of file ../../zircon/kernel/include/kernel/owned_wait_queue.h
const SchedulerState::WaitQueueInheritedSchedulerState * const_inherited_scheduler_state_storage ()
Defined at line 272 of file ../../zircon/kernel/include/kernel/owned_wait_queue.h
Enumerations
enum class WakeOption
| Name | Value |
|---|---|
| None | 0 |
| AssignOwner | 1 |
Behavior control for wake/requeue operations
Defined at line 125 of file ../../zircon/kernel/include/kernel/owned_wait_queue.h
Records
Friends
class OwnedWaitQueueTopologyTests