summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2008-08-07 21:00:13 +0000
committerjhb <jhb@FreeBSD.org>2008-08-07 21:00:13 +0000
commite306c86e1b6376905ae8d21091509cbe1f61fba8 (patch)
tree5341583d2eecb5e89baa3cba762d2f3739e4856a /share
parent9f16e510b9a765d8caed7f31ebaf16b600540db4 (diff)
downloadFreeBSD-src-e306c86e1b6376905ae8d21091509cbe1f61fba8.zip
FreeBSD-src-e306c86e1b6376905ae8d21091509cbe1f61fba8.tar.gz
Permit Giant to be passed as the explicit interlock either to
msleep/mtx_sleep or the various cv_*wait*() routines. Currently, the "unlock" behavior of PDROP and cv_wait_unlock() with Giant is not permitted as it is will be confusing since Giant is fully unrecursed and unlocked during a thread sleep. This is handy for subsystems which wish to allow unlocked drivers to continue to use Giant such as CAM, the new TTY layer, and the new USB stack. CAM currently uses a hack that I told Scott to use because I really didn't want to permit this behavior, and the TTY and USB patches both have various patches to permit this. MFC after: 2 weeks
Diffstat (limited to 'share')
-rw-r--r--share/man/man9/condvar.918
-rw-r--r--share/man/man9/sleep.96
2 files changed, 24 insertions, 0 deletions
diff --git a/share/man/man9/condvar.9 b/share/man/man9/condvar.9
index 2ac8906..db3eab1 100644
--- a/share/man/man9/condvar.9
+++ b/share/man/man9/condvar.9
@@ -136,9 +136,27 @@ When a thread waits on a condition,
.Fa lock
is atomically released before the thread is blocked, then reacquired
before the function call returns.
+In addition, the thread will fully drop the
+.Va Giant
+mutex
+(even if recursed)
+while the it is suspended and will reacquire the
+.Va Giant
+mutex before the function returns.
The
.Fn cv_wait_unlock
function does not reacquire the lock before returning.
+Note that the
+.Va Giant
+mutex may be specified as
+.Fa lock .
+However,
+.Va Giant
+may not be used as
+.Fa lock
+for the
+.Fn cv_wait_unlock
+function.
All waiters must pass the same
.Fa lock
in conjunction with
diff --git a/share/man/man9/sleep.9 b/share/man/man9/sleep.9
index aa87642..a9f0873 100644
--- a/share/man/man9/sleep.9
+++ b/share/man/man9/sleep.9
@@ -157,6 +157,12 @@ mutex
while the thread is suspended and will reacquire the
.Va Giant
mutex before the function returns.
+Note that the
+.Va Giant
+mutex may be specified as the lock to drop.
+In that case, however, the
+.Dv PDROP
+flag is not allowed.
.Pp
To avoid lost wakeups,
either a lock should be used to protect against races,
OpenPOWER on IntegriCloud