Index: share/man/man9/mutex.9 =================================================================== RCS file: /cvsroot/src/share/man/man9/mutex.9,v retrieving revision 1.25 diff -p -u -r1.25 mutex.9 --- share/man/man9/mutex.9 7 Jul 2012 21:27:56 -0000 1.25 +++ share/man/man9/mutex.9 9 Jan 2013 01:07:41 -0000 @@ -1,6 +1,6 @@ .\" $NetBSD: mutex.9,v 1.25 2012/07/07 21:27:56 rmind Exp $ .\" -.\" Copyright (c) 2007, 2009 The NetBSD Foundation, Inc. +.\" Copyright (c) 2007, 2009, 2013 The NetBSD Foundation, Inc. .\" All rights reserved. .\" .\" This code is derived from software contributed to The NetBSD Foundation @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd July 7, 2012 +.Dd January 9, 2013 .Dt MUTEX 9 .Os .Sh NAME @@ -130,11 +130,22 @@ and interrupt handlers. .Pp The .Fa ipl -argument is used to pass a system interrupt priority level (IPL) -that will block all interrupt handlers that may try to acquire the mutex. -.Pp -LWPs that own spin mutexes may not sleep, and therefore must not -try to acquire adaptive mutexes or other sleep locks. +argument is used by +.Fn mutex_enter +to set the CPU's interrupt priority level (IPL) to block interrupts +whose handlers may try to acquire the mutex while it is held. +This avoids deadlock when a LWP holding a mutex is interrupted and the +interrupt handler tries to acquire the mutex, since the LWP cannot +continue until the interrupt has been handled. +.Pp +Consequently, LWPs that own spin mutexes may not sleep, and therefore +must not try to acquire adaptive mutexes or other sleep locks. +.Pp +Note that although +.Fn mutex_enter +blocks interrupts on the current CPU, an interrupt handler must still +take the mutex itself in order to exclude LWPs and interrupt handlers +on other CPUs. .Pp A processor will always busy-wait when attempting to acquire a spin mutex that is already held.