mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-23 18:25:19 +00:00
Add a simple manpage describing the basic functionality of witness.
It needs a diagonistics section added at some point in the future.
This commit is contained in:
parent
f7012f592a
commit
a57fa8ae36
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=74931
|
@ -169,6 +169,7 @@ MAN= aac.4 \
|
|||
vr.4 \
|
||||
wb.4 \
|
||||
wi.4 \
|
||||
witness.4 \
|
||||
worm.4 \
|
||||
wx.4 \
|
||||
xl.4 \
|
||||
|
|
125
share/man/man4/witness.4
Normal file
125
share/man/man4/witness.4
Normal file
|
@ -0,0 +1,125 @@
|
|||
.\" Copyright (c) 2001 John H. Baldwin <jhb@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$
|
||||
.\"
|
||||
.Dd February 18, 2001
|
||||
.Dt WITNESS 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm witness
|
||||
.Nd lock validation facility
|
||||
.Sh SYNOPSIS
|
||||
.Cd options WITNESS
|
||||
.Cd options WITNESS_DDB
|
||||
.Cd options WITNESS_SKIPSPIN
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
module keeps track of the locks acquired and released by each thread.
|
||||
It also keeps track of the order in which locks are acquired with respect
|
||||
to each other.
|
||||
Each time a lock is acquired,
|
||||
.Nm
|
||||
uses these two lists to verify that a lock is not being acquired in the
|
||||
wrong order.
|
||||
If a lock order violation is detected, then a message is output to the
|
||||
kernel console detailing the locks involved and the locations in question.
|
||||
Witness can also be configured to drop into the kernel debugger when an order
|
||||
violation occurs.
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
code also checks various other conditions such as verifying that one
|
||||
does not recurse on a non-recursive lock.
|
||||
For sleep locks,
|
||||
.Nm
|
||||
verifies that a new process would not be switched to when a lock is released
|
||||
or a lock is blocked on during an acquire while any spin locks are held.
|
||||
If any of these checks fail, then the kernel will panic.
|
||||
.Pp
|
||||
The flag that controls whether or not the kernel debugger is entered when a
|
||||
lock order violation is detected can be set in a variety of ways.
|
||||
By default, the flag is off, but if the "WITNESS_DDB" kernel option is
|
||||
specified, then the flag will default to on.
|
||||
It can also be set from the
|
||||
.Xr loader 8
|
||||
via the
|
||||
.Sy debug.witness_ddb
|
||||
environment variable or after the kernel has booted via the
|
||||
.Sy debug.witness_ddb
|
||||
sysctl.
|
||||
If the flag is set to zero, then the debugger will not be entered.
|
||||
If the flag is non-zero, then the debugger will be entered.
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
code can also be configured to skip all checks on spin mutexes.
|
||||
By default, this flag defaults to off, but it can be turned on by
|
||||
specifying the "WITNESS_SKIPSPIN" kernel option.
|
||||
The flag can also be set via the
|
||||
.Xr loader 8
|
||||
environment variable
|
||||
.Sy debug.witness.skipspin .
|
||||
If the variable is set to a non-zero value, then spin mutexes are skipped.
|
||||
Once the kernel has booted, the status of this flag can be examined but not
|
||||
set via the read-only sysctl
|
||||
.Sy debug.witness_skipspin .
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
code also provides two extra
|
||||
.Xr ddb 4
|
||||
commands if both
|
||||
.Nm
|
||||
and
|
||||
.Xr ddb 4
|
||||
are compiled into the kernel:
|
||||
.Bl -ohang
|
||||
.It Ic show locks
|
||||
Outputs the list of locks held by the current thread to the kernel console
|
||||
along with the filename and line number at which each lock was last acquired
|
||||
by this thread.
|
||||
.It Ic show witness
|
||||
Dump the current order list to the kernel console.
|
||||
The code first displays the lock order tree for all of the sleep locks.
|
||||
Then it displays the lock order tree for all of the spin locks.
|
||||
Finally, it displays a list of locks that have not yet been acquired.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr ddb 4 ,
|
||||
.Xr mutex 9
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
code first appeared in
|
||||
.Tn BSD/OS
|
||||
5.0 and were imported from there into
|
||||
.Fx 5.0 .
|
||||
.Sh BUGS
|
||||
The
|
||||
.Nm
|
||||
code currently doesn't handle recursion of shared
|
||||
.Xr sx 9
|
||||
locks properly.
|
Loading…
Reference in a new issue