Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/subr_witness.c
Show First 20 Lines • Show All 366 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* If set to 0, lock order checking is disabled. If set to -1, | * If set to 0, lock order checking is disabled. If set to -1, | ||||
* witness is completely disabled. Otherwise witness performs full | * witness is completely disabled. Otherwise witness performs full | ||||
* lock order checking for all locks. At runtime, lock order checking | * lock order checking for all locks. At runtime, lock order checking | ||||
* may be toggled. However, witness cannot be reenabled once it is | * may be toggled. However, witness cannot be reenabled once it is | ||||
* completely disabled. | * completely disabled. | ||||
*/ | */ | ||||
static int witness_watch = 1; | static int witness_watch = 1; | ||||
SYSCTL_PROC(_debug_witness, OID_AUTO, watch, CTLFLAG_RWTUN | CTLTYPE_INT, NULL, 0, | SYSCTL_PROC(_debug_witness, OID_AUTO, watch, | ||||
sysctl_debug_witness_watch, "I", "witness is watching lock operations"); | CTLFLAG_RWTUN | CTLTYPE_INT | CTLFLAG_NEEDGIANT, | ||||
NULL, 0, sysctl_debug_witness_watch, "I", | |||||
"witness is watching lock operations"); | |||||
#ifdef KDB | #ifdef KDB | ||||
/* | /* | ||||
* When KDB is enabled and witness_kdb is 1, it will cause the system | * When KDB is enabled and witness_kdb is 1, it will cause the system | ||||
* to drop into kdebug() when: | * to drop into kdebug() when: | ||||
* - a lock hierarchy violation occurs | * - a lock hierarchy violation occurs | ||||
* - locks are held when going to sleep. | * - locks are held when going to sleep. | ||||
*/ | */ | ||||
Show All 34 Lines | |||||
*/ | */ | ||||
enum witness_channel { | enum witness_channel { | ||||
WITNESS_CONSOLE, | WITNESS_CONSOLE, | ||||
WITNESS_LOG, | WITNESS_LOG, | ||||
WITNESS_NONE, | WITNESS_NONE, | ||||
}; | }; | ||||
static enum witness_channel witness_channel = WITNESS_CONSOLE; | static enum witness_channel witness_channel = WITNESS_CONSOLE; | ||||
SYSCTL_PROC(_debug_witness, OID_AUTO, output_channel, CTLTYPE_STRING | | SYSCTL_PROC(_debug_witness, OID_AUTO, output_channel, | ||||
CTLFLAG_RWTUN, NULL, 0, sysctl_debug_witness_channel, "A", | CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, | ||||
NULL, 0, sysctl_debug_witness_channel, "A", | |||||
"Output channel for warnings"); | "Output channel for warnings"); | ||||
/* | /* | ||||
* Call this to print out the relations between locks. | * Call this to print out the relations between locks. | ||||
*/ | */ | ||||
SYSCTL_PROC(_debug_witness, OID_AUTO, fullgraph, CTLTYPE_STRING | CTLFLAG_RD, | SYSCTL_PROC(_debug_witness, OID_AUTO, fullgraph, | ||||
NULL, 0, sysctl_debug_witness_fullgraph, "A", "Show locks relation graphs"); | CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, | ||||
NULL, 0, sysctl_debug_witness_fullgraph, "A", | |||||
"Show locks relation graphs"); | |||||
/* | /* | ||||
* Call this to print out the witness faulty stacks. | * Call this to print out the witness faulty stacks. | ||||
*/ | */ | ||||
SYSCTL_PROC(_debug_witness, OID_AUTO, badstacks, CTLTYPE_STRING | CTLFLAG_RD, | SYSCTL_PROC(_debug_witness, OID_AUTO, badstacks, | ||||
NULL, 0, sysctl_debug_witness_badstacks, "A", "Show bad witness stacks"); | CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, | ||||
NULL, 0, sysctl_debug_witness_badstacks, "A", | |||||
"Show bad witness stacks"); | |||||
static struct mtx w_mtx; | static struct mtx w_mtx; | ||||
/* w_list */ | /* w_list */ | ||||
static struct witness_list w_free = STAILQ_HEAD_INITIALIZER(w_free); | static struct witness_list w_free = STAILQ_HEAD_INITIALIZER(w_free); | ||||
static struct witness_list w_all = STAILQ_HEAD_INITIALIZER(w_all); | static struct witness_list w_all = STAILQ_HEAD_INITIALIZER(w_all); | ||||
/* w_typelist */ | /* w_typelist */ | ||||
▲ Show 20 Lines • Show All 2,644 Lines • Show Last 20 Lines |