2007-03-14 04:00:24 +00:00
|
|
|
.\" Copyright (c) 2007 Julian Elischer (julian - freebsd org )
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2012-05-29 14:41:16 +00:00
|
|
|
.Dd May 25, 2012
|
2007-03-14 04:00:24 +00:00
|
|
|
.Dt LOCKING 9
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
2007-03-19 07:49:11 +00:00
|
|
|
.Nm locking
|
2007-03-14 04:00:24 +00:00
|
|
|
.Nd kernel synchronization primitives
|
|
|
|
.Sh DESCRIPTION
|
2007-06-01 03:11:47 +00:00
|
|
|
The
|
2007-03-14 04:00:24 +00:00
|
|
|
.Em FreeBSD
|
|
|
|
kernel is written to run across multiple CPUs and as such requires
|
2007-06-01 03:11:47 +00:00
|
|
|
several different synchronization primitives to allow the developers
|
2007-03-14 04:00:24 +00:00
|
|
|
to safely access and manipulate the many data types required.
|
2007-08-09 21:09:56 +00:00
|
|
|
.Ss Mutexes
|
2010-02-13 12:03:03 +00:00
|
|
|
Mutexes (also called "sleep mutexes") are the most commonly used
|
|
|
|
synchronization primitive in the kernel.
|
2010-01-28 17:09:47 +00:00
|
|
|
Thread acquires (locks) a mutex before accessing data shared with other
|
|
|
|
threads (including interrupt threads), and releases (unlocks) it afterwards.
|
2010-01-28 19:57:24 +00:00
|
|
|
If the mutex cannot be acquired, the thread requesting it will sleep.
|
|
|
|
Mutexes fully support priority propagation.
|
2010-01-28 17:09:47 +00:00
|
|
|
.Pp
|
2010-01-28 21:14:12 +00:00
|
|
|
See
|
2010-01-28 17:09:47 +00:00
|
|
|
.Xr mutex 9
|
2010-01-28 21:14:12 +00:00
|
|
|
for details.
|
2010-01-28 17:09:47 +00:00
|
|
|
.Ss Spin mutexes
|
|
|
|
Spin mutexes are variation of basic mutexes; the main difference between
|
2010-01-28 19:57:24 +00:00
|
|
|
the two is that spin mutexes never sleep - instead, they spin, waiting
|
2010-01-28 17:09:47 +00:00
|
|
|
for the thread holding the lock, which runs on another CPU, to release it.
|
|
|
|
Differently from ordinary mutex, spin mutexes disable interrupts when acquired.
|
|
|
|
Since disabling interrupts is expensive, they are also generally slower.
|
2010-07-31 12:14:28 +00:00
|
|
|
Spin mutexes should be used only when necessary, e.g. to protect data shared
|
2010-02-13 12:03:03 +00:00
|
|
|
with interrupt filter code (see
|
|
|
|
.Xr bus_setup_intr 9
|
|
|
|
for details).
|
2010-01-28 17:09:47 +00:00
|
|
|
.Ss Pool mutexes
|
2010-07-31 12:14:28 +00:00
|
|
|
With most synchronization primitives, such as mutexes, programmer must
|
2010-01-28 17:09:47 +00:00
|
|
|
provide a piece of allocated memory to hold the primitive.
|
|
|
|
For example, a mutex may be embedded inside the structure it protects.
|
|
|
|
Pool mutex is a variant of mutex without this requirement - to lock or unlock
|
|
|
|
a pool mutex, one uses address of the structure being protected with it,
|
|
|
|
not the mutex itself.
|
|
|
|
Pool mutexes are seldom used.
|
|
|
|
.Pp
|
2010-01-28 21:14:12 +00:00
|
|
|
See
|
2010-01-28 17:09:47 +00:00
|
|
|
.Xr mtx_pool 9
|
2010-01-28 21:14:12 +00:00
|
|
|
for details.
|
2010-01-28 17:09:47 +00:00
|
|
|
.Ss Reader/writer locks
|
2007-03-14 04:00:24 +00:00
|
|
|
Reader/writer locks allow shared access to protected data by multiple threads,
|
|
|
|
or exclusive access by a single thread.
|
|
|
|
The threads with shared access are known as
|
|
|
|
.Em readers
|
2007-08-09 21:09:56 +00:00
|
|
|
since they should only read the protected data.
|
2007-03-14 04:00:24 +00:00
|
|
|
A thread with exclusive access is known as a
|
|
|
|
.Em writer
|
2007-08-09 21:09:56 +00:00
|
|
|
since it may modify protected data.
|
2007-03-14 04:00:24 +00:00
|
|
|
.Pp
|
2007-08-09 21:09:56 +00:00
|
|
|
Reader/writer locks can be treated as mutexes (see above and
|
2007-03-14 04:00:24 +00:00
|
|
|
.Xr mutex 9 )
|
|
|
|
with shared/exclusive semantics.
|
2012-03-29 05:02:12 +00:00
|
|
|
More specifically, regular mutexes can be
|
2007-08-09 21:09:56 +00:00
|
|
|
considered to be equivalent to a write-lock on an
|
|
|
|
.Em rw_lock.
|
2007-03-14 04:00:24 +00:00
|
|
|
The
|
|
|
|
.Em rw_lock
|
|
|
|
locks have priority propagation like mutexes, but priority
|
|
|
|
can be propagated only to an exclusive holder.
|
|
|
|
This limitation comes from the fact that shared owners
|
|
|
|
are anonymous.
|
|
|
|
Another important property is that shared holders of
|
|
|
|
.Em rw_lock
|
2007-08-09 21:09:56 +00:00
|
|
|
can recurse, but exclusive locks are not allowed to recurse.
|
2012-03-29 05:02:12 +00:00
|
|
|
This ability should not be used lightly and
|
2007-08-09 21:09:56 +00:00
|
|
|
.Em may go away.
|
2010-01-28 17:09:47 +00:00
|
|
|
.Pp
|
2010-01-28 21:14:12 +00:00
|
|
|
See
|
2010-01-28 17:09:47 +00:00
|
|
|
.Xr rwlock 9
|
2010-01-28 21:14:12 +00:00
|
|
|
for details.
|
2010-01-28 17:09:47 +00:00
|
|
|
.Ss Read-mostly locks
|
2007-11-08 14:47:55 +00:00
|
|
|
Mostly reader locks are similar to
|
2010-01-28 19:57:24 +00:00
|
|
|
.Em reader/writer
|
|
|
|
locks but optimized for very infrequent write locking.
|
|
|
|
.Em Read-mostly
|
2007-11-08 14:47:55 +00:00
|
|
|
locks implement full priority propagation by tracking shared owners
|
2010-02-15 17:41:59 +00:00
|
|
|
using a caller-supplied
|
2007-11-08 14:47:55 +00:00
|
|
|
.Em tracker
|
|
|
|
data structure.
|
2010-01-28 17:09:47 +00:00
|
|
|
.Pp
|
2010-01-28 21:14:12 +00:00
|
|
|
See
|
2010-01-28 17:09:47 +00:00
|
|
|
.Xr rmlock 9
|
2010-01-28 21:14:12 +00:00
|
|
|
for details.
|
2010-01-28 17:09:47 +00:00
|
|
|
.Ss Shared/exclusive locks
|
2010-01-28 19:57:24 +00:00
|
|
|
Shared/exclusive locks are similar to reader/writer locks; the main difference
|
|
|
|
between them is that shared/exclusive locks may be held during unbounded sleep
|
|
|
|
(and may thus perform an unbounded sleep).
|
|
|
|
They are inherently less efficient than mutexes, reader/writer locks
|
2010-02-10 19:03:48 +00:00
|
|
|
and read-mostly locks.
|
|
|
|
They don't support priority propagation.
|
2010-01-28 19:57:24 +00:00
|
|
|
They should be considered to be closely related to
|
2007-08-09 21:09:56 +00:00
|
|
|
.Xr sleep 9 .
|
2012-03-29 05:02:12 +00:00
|
|
|
In fact it could in some cases be
|
2007-08-09 21:09:56 +00:00
|
|
|
considered a conditional sleep.
|
2010-01-28 17:09:47 +00:00
|
|
|
.Pp
|
2010-01-28 21:14:12 +00:00
|
|
|
See
|
2010-01-28 17:09:47 +00:00
|
|
|
.Xr sx 9
|
2010-01-28 21:14:12 +00:00
|
|
|
for details.
|
2010-01-28 17:09:47 +00:00
|
|
|
.Ss Counting semaphores
|
|
|
|
Counting semaphores provide a mechanism for synchronizing access
|
|
|
|
to a pool of resources.
|
|
|
|
Unlike mutexes, semaphores do not have the concept of an owner,
|
|
|
|
so they can be useful in situations where one thread needs
|
|
|
|
to acquire a resource, and another thread needs to release it.
|
|
|
|
They are largely deprecated.
|
|
|
|
.Pp
|
2010-01-28 21:14:12 +00:00
|
|
|
See
|
2010-01-28 17:09:47 +00:00
|
|
|
.Xr sema 9
|
2010-01-28 21:14:12 +00:00
|
|
|
for details.
|
2007-03-14 04:00:24 +00:00
|
|
|
.Ss Condition variables
|
2007-03-18 19:28:44 +00:00
|
|
|
Condition variables are used in conjunction with mutexes to wait for
|
|
|
|
conditions to occur.
|
2007-03-14 04:00:24 +00:00
|
|
|
A thread must hold the mutex before calling the
|
|
|
|
.Fn cv_wait* ,
|
|
|
|
functions.
|
|
|
|
When a thread waits on a condition, the mutex
|
|
|
|
is atomically released before the thread is blocked, then reacquired
|
|
|
|
before the function call returns.
|
2010-01-28 17:09:47 +00:00
|
|
|
.Pp
|
2010-01-28 21:14:12 +00:00
|
|
|
See
|
2010-01-28 17:09:47 +00:00
|
|
|
.Xr condvar 9
|
2010-01-28 21:14:12 +00:00
|
|
|
for details.
|
2007-03-14 04:00:24 +00:00
|
|
|
.Ss Giant
|
2010-01-28 19:57:24 +00:00
|
|
|
Giant is an instance of a mutex, with some special characteristics:
|
2007-05-31 00:05:59 +00:00
|
|
|
.Bl -enum
|
|
|
|
.It
|
|
|
|
It is recursive.
|
|
|
|
.It
|
2010-02-10 17:02:06 +00:00
|
|
|
Drivers and filesystems can request that Giant be locked around them
|
2010-02-10 19:03:48 +00:00
|
|
|
by not marking themselves MPSAFE.
|
|
|
|
Note that infrastructure to do this is slowly going away as non-MPSAFE
|
|
|
|
drivers either became properly locked or disappear.
|
2007-05-31 00:05:59 +00:00
|
|
|
.It
|
2007-08-09 21:09:56 +00:00
|
|
|
Giant must be locked first before other locks.
|
2007-05-31 00:05:59 +00:00
|
|
|
.It
|
2010-02-10 17:02:06 +00:00
|
|
|
It is OK to hold Giant while performing unbounded sleep; in such case,
|
|
|
|
Giant will be dropped before sleeping and picked up after wakeup.
|
|
|
|
.It
|
2007-05-31 00:05:59 +00:00
|
|
|
There are places in the kernel that drop Giant and pick it back up
|
|
|
|
again.
|
|
|
|
Sleep locks will do this before sleeping.
|
2010-01-28 19:57:24 +00:00
|
|
|
Parts of the network or VM code may do this as well, depending on the
|
2007-05-31 00:05:59 +00:00
|
|
|
setting of a sysctl.
|
|
|
|
This means that you cannot count on Giant keeping other code from
|
|
|
|
running if your code sleeps, even if you want it to.
|
|
|
|
.El
|
2007-03-14 04:00:24 +00:00
|
|
|
.Ss Sleep/wakeup
|
|
|
|
The functions
|
|
|
|
.Fn tsleep ,
|
|
|
|
.Fn msleep ,
|
|
|
|
.Fn msleep_spin ,
|
|
|
|
.Fn pause ,
|
|
|
|
.Fn wakeup ,
|
|
|
|
and
|
|
|
|
.Fn wakeup_one
|
|
|
|
handle event-based thread blocking.
|
2007-03-18 19:28:44 +00:00
|
|
|
If a thread must wait for an external event, it is put to sleep by
|
2007-03-14 04:00:24 +00:00
|
|
|
.Fn tsleep ,
|
|
|
|
.Fn msleep ,
|
|
|
|
.Fn msleep_spin ,
|
|
|
|
or
|
|
|
|
.Fn pause .
|
|
|
|
Threads may also wait using one of the locking primitive sleep routines
|
|
|
|
.Xr mtx_sleep 9 ,
|
|
|
|
.Xr rw_sleep 9 ,
|
|
|
|
or
|
|
|
|
.Xr sx_sleep 9 .
|
|
|
|
.Pp
|
|
|
|
The parameter
|
|
|
|
.Fa chan
|
|
|
|
is an arbitrary address that uniquely identifies the event on which
|
|
|
|
the thread is being put to sleep.
|
|
|
|
All threads sleeping on a single
|
|
|
|
.Fa chan
|
|
|
|
are woken up later by
|
|
|
|
.Fn wakeup ,
|
|
|
|
often called from inside an interrupt routine, to indicate that the
|
|
|
|
resource the thread was blocking on is available now.
|
|
|
|
.Pp
|
|
|
|
Several of the sleep functions including
|
|
|
|
.Fn msleep ,
|
|
|
|
.Fn msleep_spin ,
|
|
|
|
and the locking primitive sleep routines specify an additional lock
|
|
|
|
parameter.
|
|
|
|
The lock will be released before sleeping and reacquired
|
|
|
|
before the sleep routine returns.
|
|
|
|
If
|
|
|
|
.Fa priority
|
|
|
|
includes the
|
|
|
|
.Dv PDROP
|
2007-03-18 19:28:44 +00:00
|
|
|
flag, then the lock will not be reacquired before returning.
|
2007-03-14 04:00:24 +00:00
|
|
|
The lock is used to ensure that a condition can be checked atomically,
|
|
|
|
and that the current thread can be suspended without missing a
|
|
|
|
change to the condition, or an associated wakeup.
|
|
|
|
In addition, all of the sleep routines will fully drop the
|
|
|
|
.Va Giant
|
|
|
|
mutex
|
|
|
|
(even if recursed)
|
|
|
|
while the thread is suspended and will reacquire the
|
|
|
|
.Va Giant
|
|
|
|
mutex before the function returns.
|
|
|
|
.Pp
|
2010-01-28 21:14:12 +00:00
|
|
|
See
|
2010-01-28 17:09:47 +00:00
|
|
|
.Xr sleep 9
|
2010-01-28 21:14:12 +00:00
|
|
|
for details.
|
2010-01-28 17:09:47 +00:00
|
|
|
.Ss Lockmanager locks
|
2010-01-28 19:57:24 +00:00
|
|
|
Shared/exclusive locks, used mostly in
|
2010-01-28 17:09:47 +00:00
|
|
|
.Xr VFS 9 ,
|
|
|
|
in particular as a
|
|
|
|
.Xr vnode 9
|
|
|
|
lock.
|
|
|
|
They have features other lock types don't have, such as sleep timeout,
|
|
|
|
writer starvation avoidance, draining, and interlock mutex, but this makes them
|
|
|
|
complicated to implement; for this reason, they are deprecated.
|
|
|
|
.Pp
|
2010-01-28 21:14:12 +00:00
|
|
|
See
|
2007-03-14 04:00:24 +00:00
|
|
|
.Xr lock 9
|
2010-01-28 21:14:12 +00:00
|
|
|
for details.
|
2010-01-28 17:09:47 +00:00
|
|
|
.Sh INTERACTIONS
|
2010-02-13 12:03:03 +00:00
|
|
|
The primitives interact and have a number of rules regarding how
|
|
|
|
they can and can not be combined.
|
|
|
|
Many of these rules are checked using the
|
|
|
|
.Xr witness 4
|
|
|
|
code.
|
2010-01-28 19:57:24 +00:00
|
|
|
.Ss Bounded vs. unbounded sleep
|
|
|
|
The following primitives perform bounded sleep: mutexes, pool mutexes,
|
|
|
|
reader/writer locks and read-mostly locks.
|
|
|
|
.Pp
|
|
|
|
The following primitives block (perform unbounded sleep): shared/exclusive locks,
|
|
|
|
counting semaphores, condition variables, sleep/wakeup and lockmanager locks.
|
|
|
|
.Pp
|
|
|
|
It is an error to do any operation that could result in any kind of sleep while
|
|
|
|
holding spin mutex.
|
|
|
|
.Pp
|
|
|
|
As a general rule, it is an error to do any operation that could result
|
|
|
|
in unbounded sleep while holding any primitive from the 'bounded sleep' group.
|
|
|
|
For example, it is an error to try to acquire shared/exclusive lock while
|
|
|
|
holding mutex, or to try to allocate memory with M_WAITOK while holding
|
|
|
|
read-write lock.
|
|
|
|
.Pp
|
|
|
|
As a special case, it is possible to call
|
2010-02-15 17:41:59 +00:00
|
|
|
.Fn sleep
|
2010-01-28 19:57:24 +00:00
|
|
|
or
|
2010-02-15 17:41:59 +00:00
|
|
|
.Fn mtx_sleep
|
|
|
|
while holding a single mutex.
|
|
|
|
It will atomically drop that mutex and reacquire it as part of waking up.
|
|
|
|
This is often a bad idea because it generally relies on the programmer having
|
|
|
|
good knowledge of all of the call graph above the place where
|
|
|
|
.Fn mtx_sleep
|
|
|
|
is being called and assumptions the calling code has made.
|
2012-05-12 03:46:43 +00:00
|
|
|
Because the lock gets dropped during sleep, one must re-test all
|
2010-02-15 17:41:59 +00:00
|
|
|
the assumptions that were made before, all the way up the call graph to the
|
|
|
|
place where the lock was acquired.
|
2010-02-10 17:02:06 +00:00
|
|
|
.Pp
|
2010-02-13 12:03:03 +00:00
|
|
|
It is an error to do any operation that could result in any kind of sleep when
|
|
|
|
running inside an interrupt filter.
|
|
|
|
.Pp
|
2010-02-10 17:02:06 +00:00
|
|
|
It is an error to do any operation that could result in unbounded sleep when
|
|
|
|
running inside an interrupt thread.
|
2010-01-28 19:57:24 +00:00
|
|
|
.Ss Interaction table
|
2010-02-13 12:03:03 +00:00
|
|
|
The following table shows what you can and can not do while holding
|
|
|
|
one of the synchronization primitives discussed:
|
2010-01-28 19:57:24 +00:00
|
|
|
.Bl -column ".Ic xxxxxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXX" -offset indent
|
2012-03-29 20:55:45 +00:00
|
|
|
.It Em "You have: You want:" Ta spin mtx Ta mutex Ta sx Ta rwlock Ta rmlock Ta sleep
|
2010-02-13 12:03:03 +00:00
|
|
|
.It spin mtx Ta \&ok-1 Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no-3
|
|
|
|
.It mutex Ta \&ok Ta \&ok-1 Ta \&no Ta \&ok Ta \&ok Ta \&no-3
|
|
|
|
.It sx Ta \&ok Ta \&ok Ta \&ok-2 Ta \&ok Ta \&ok Ta \&ok-4
|
|
|
|
.It rwlock Ta \&ok Ta \&ok Ta \&no Ta \&ok-2 Ta \&ok Ta \&no-3
|
2012-05-29 14:41:16 +00:00
|
|
|
.It rmlock Ta \&ok Ta \&ok Ta \&no-5 Ta \&ok Ta \&ok-2 Ta \&no-5
|
2007-03-14 04:00:24 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
.Em *1
|
2007-08-09 21:09:56 +00:00
|
|
|
Recursion is defined per lock.
|
|
|
|
Lock order is important.
|
2007-03-14 04:00:24 +00:00
|
|
|
.Pp
|
|
|
|
.Em *2
|
2010-02-15 17:41:59 +00:00
|
|
|
Readers can recurse though writers can not.
|
2007-08-09 21:09:56 +00:00
|
|
|
Lock order is important.
|
2007-03-14 04:00:24 +00:00
|
|
|
.Pp
|
|
|
|
.Em *3
|
2010-02-15 17:41:59 +00:00
|
|
|
There are calls that atomically release this primitive when going to sleep
|
2007-06-01 03:11:47 +00:00
|
|
|
and reacquire it on wakeup (e.g.
|
2007-03-14 04:00:24 +00:00
|
|
|
.Fn mtx_sleep ,
|
2007-03-14 06:12:36 +00:00
|
|
|
.Fn rw_sleep
|
2007-06-01 03:11:47 +00:00
|
|
|
and
|
2012-05-20 16:43:47 +00:00
|
|
|
.Fn msleep_spin ) .
|
2007-03-14 04:00:24 +00:00
|
|
|
.Pp
|
|
|
|
.Em *4
|
2007-06-01 03:11:47 +00:00
|
|
|
Though one can sleep holding an sx lock, one can also use
|
2007-03-14 04:00:24 +00:00
|
|
|
.Fn sx_sleep
|
2010-02-15 17:41:59 +00:00
|
|
|
which will atomically release this primitive when going to sleep and
|
2007-03-18 19:28:44 +00:00
|
|
|
reacquire it on wakeup.
|
2010-09-01 19:50:03 +00:00
|
|
|
.Pp
|
|
|
|
.Em *5
|
|
|
|
.Em Read-mostly
|
|
|
|
locks can be initialized to support sleeping while holding a write lock.
|
|
|
|
See
|
|
|
|
.Xr rmlock 9
|
|
|
|
for details.
|
2010-01-28 19:57:24 +00:00
|
|
|
.Ss Context mode table
|
2007-03-18 19:28:44 +00:00
|
|
|
The next table shows what can be used in different contexts.
|
|
|
|
At this time this is a rather easy to remember table.
|
2010-01-28 19:57:24 +00:00
|
|
|
.Bl -column ".Ic Xxxxxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXX" -offset indent
|
2012-03-29 20:55:45 +00:00
|
|
|
.It Em "Context:" Ta spin mtx Ta mutex Ta sx Ta rwlock Ta rmlock Ta sleep
|
2012-03-29 05:02:12 +00:00
|
|
|
.It interrupt filter: Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no
|
|
|
|
.It interrupt thread: Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&ok Ta \&no
|
|
|
|
.It callout: Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&no Ta \&no
|
|
|
|
.It syscall: Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok
|
2007-03-14 06:27:02 +00:00
|
|
|
.El
|
2007-03-14 04:00:24 +00:00
|
|
|
.Sh SEE ALSO
|
2010-02-15 17:41:59 +00:00
|
|
|
.Xr witness 4 ,
|
2007-03-14 04:00:24 +00:00
|
|
|
.Xr condvar 9 ,
|
2007-06-21 16:39:25 +00:00
|
|
|
.Xr lock 9 ,
|
2007-03-14 04:00:24 +00:00
|
|
|
.Xr mtx_pool 9 ,
|
2007-08-09 21:09:56 +00:00
|
|
|
.Xr mutex 9 ,
|
2007-11-08 14:47:55 +00:00
|
|
|
.Xr rmlock 9 ,
|
2007-03-14 04:00:24 +00:00
|
|
|
.Xr rwlock 9 ,
|
|
|
|
.Xr sema 9 ,
|
|
|
|
.Xr sleep 9 ,
|
2007-06-21 16:39:25 +00:00
|
|
|
.Xr sx 9 ,
|
2010-11-03 18:49:50 +00:00
|
|
|
.Xr BUS_SETUP_INTR 9 ,
|
2010-01-28 17:09:47 +00:00
|
|
|
.Xr LOCK_PROFILING 9
|
2007-03-14 04:00:24 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
These
|
|
|
|
functions appeared in
|
2007-06-01 03:11:47 +00:00
|
|
|
.Bsx 4.1
|
2007-03-14 04:00:24 +00:00
|
|
|
through
|
2012-05-20 16:43:47 +00:00
|
|
|
.Fx 7.0 .
|
2010-01-28 17:09:47 +00:00
|
|
|
.Sh BUGS
|
|
|
|
There are too many locking primitives to choose from.
|