FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_ddb.h"
#include "opt_hwpmc_hooks.h"
#include "opt_stack.h"
#include "opt_witness.h"
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/sbuf.h>
#include <sys/sched.h>
#include <sys/stack.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
#include <sys/systm.h>
#include <machine/stdarg.h>
Go to the source code of this file.
Data Structures | |
struct | lock_instance |
struct | lock_list_entry |
struct | witness |
struct | witness_hash |
struct | witness_lock_order_key |
struct | witness_lock_order_data |
struct | witness_lock_order_hash |
struct | witness_blessed |
struct | witness_pendhelp |
struct | witness_order_list_entry |
Macros | |
#define | KTR_WITNESS 0 |
#define | LI_RECURSEMASK 0x0000ffff /* Recursion depth of lock instance. */ |
#define | LI_EXCLUSIVE 0x00010000 /* Exclusive lock instance. */ |
#define | LI_NORELEASE 0x00020000 /* Lock not allowed to be released. */ |
#define | LI_SLEEPABLE 0x00040000 /* Lock may be held while sleeping. */ |
#define | WITNESS_COUNT 1536 |
#define | WITNESS_HASH_SIZE 251 /* Prime, gives load factor < 2 */ |
#define | WITNESS_PENDLIST (512 + (MAXCPU * 4)) |
#define | WITNESS_LO_DATA_COUNT 2048 |
#define | WITNESS_LO_HASH_SIZE 1021 |
#define | LOCK_NCHILDREN 5 |
#define | LOCK_CHILDCOUNT 2048 |
#define | MAX_W_NAME 64 |
#define | FULLGRAPH_SBUF_SIZE 512 |
#define | WITNESS_UNRELATED 0x00 /* No lock order relation. */ |
#define | WITNESS_PARENT 0x01 /* Parent, aka direct ancestor. */ |
#define | WITNESS_ANCESTOR 0x02 /* Direct or indirect ancestor. */ |
#define | WITNESS_CHILD 0x04 /* Child, aka direct descendant. */ |
#define | WITNESS_DESCENDANT 0x08 /* Direct or indirect descendant. */ |
#define | WITNESS_ANCESTOR_MASK (WITNESS_PARENT | WITNESS_ANCESTOR) |
#define | WITNESS_DESCENDANT_MASK (WITNESS_CHILD | WITNESS_DESCENDANT) |
#define | WITNESS_RELATED_MASK (WITNESS_ANCESTOR_MASK | WITNESS_DESCENDANT_MASK) |
#define | WITNESS_REVERSAL |
#define | WITNESS_RESERVED1 0x20 /* Unused flag, reserved. */ |
#define | WITNESS_RESERVED2 0x40 /* Unused flag, reserved. */ |
#define | WITNESS_LOCK_ORDER_KNOWN 0x80 /* This lock order is known. */ |
#define | WITNESS_DTOA(x) (((x) & WITNESS_RELATED_MASK) >> 2) |
#define | WITNESS_ATOD(x) (((x) & WITNESS_RELATED_MASK) << 2) |
#define | WITNESS_INDEX_ASSERT(i) MPASS((i) > 0 && (i) <= w_max_used_index && (i) < witness_count) |
Enumerations | |
enum | witness_channel { WITNESS_CONSOLE , WITNESS_LOG , WITNESS_NONE } |
Functions | |
__FBSDID ("$FreeBSD$") | |
static | MALLOC_DEFINE (M_WITNESS, "Witness", "Witness") |
STAILQ_HEAD (witness_list, witness) | |
static __inline int | witness_lock_type_equal (struct witness *w1, struct witness *w2) |
static __inline int | witness_lock_order_key_equal (const struct witness_lock_order_key *a, const struct witness_lock_order_key *b) |
static int | _isitmyx (struct witness *w1, struct witness *w2, int rmask, const char *fname) |
static void | adopt (struct witness *parent, struct witness *child) |
static int | blessed (struct witness *, struct witness *) |
static void | depart (struct witness *w) |
static struct witness * | enroll (const char *description, struct lock_class *lock_class) |
static struct lock_instance * | find_instance (struct lock_list_entry *list, const struct lock_object *lock) |
static int | isitmychild (struct witness *parent, struct witness *child) |
static int | isitmydescendant (struct witness *parent, struct witness *child) |
static void | itismychild (struct witness *parent, struct witness *child) |
static int | sysctl_debug_witness_badstacks (SYSCTL_HANDLER_ARGS) |
static int | sysctl_debug_witness_watch (SYSCTL_HANDLER_ARGS) |
static int | sysctl_debug_witness_fullgraph (SYSCTL_HANDLER_ARGS) |
static int | sysctl_debug_witness_channel (SYSCTL_HANDLER_ARGS) |
static void | witness_add_fullgraph (struct sbuf *sb, struct witness *parent) |
static void | witness_enter_debugger (const char *msg) |
static void | witness_debugger (int cond, const char *msg) |
static void | witness_free (struct witness *m) |
static struct witness * | witness_get (void) |
static uint32_t | witness_hash_djb2 (const uint8_t *key, uint32_t size) |
static struct witness * | witness_hash_get (const char *key) |
static void | witness_hash_put (struct witness *w) |
static void | witness_init_hash_tables (void) |
static void | witness_increment_graph_generation (void) |
static void | witness_lock_list_free (struct lock_list_entry *lle) |
static struct lock_list_entry * | witness_lock_list_get (void) |
static int | witness_lock_order_add (struct witness *parent, struct witness *child) |
static int | witness_lock_order_check (struct witness *parent, struct witness *child) |
static struct witness_lock_order_data * | witness_lock_order_get (struct witness *parent, struct witness *child) |
static void | witness_list_lock (struct lock_instance *instance, int(*prnt)(const char *fmt,...)) |
static int | witness_output (const char *fmt,...) __printflike(1 |
static int static int | witness_output_drain (void *arg __unused, const char *data, int len) |
static int | witness_voutput (const char *fmt, va_list ap) __printflike(1 |
static int static void | witness_setflag (struct lock_object *lock, int flag, int set) |
FEATURE (witness, "kernel has witness(9) support") | |
static | SYSCTL_NODE (_debug, OID_AUTO, witness, CTLFLAG_RW|CTLFLAG_MPSAFE, NULL, "Witness Locking") |
SYSCTL_PROC (_debug_witness, OID_AUTO, watch, CTLFLAG_RWTUN|CTLTYPE_INT|CTLFLAG_MPSAFE, NULL, 0, sysctl_debug_witness_watch, "I", "witness is watching lock operations") | |
SYSCTL_INT (_debug_witness, OID_AUTO, skipspin, CTLFLAG_RDTUN, &witness_skipspin, 0, "") | |
SYSCTL_INT (_debug_witness, OID_AUTO, witness_count, CTLFLAG_RDTUN, &witness_count, 0, "") | |
SYSCTL_PROC (_debug_witness, OID_AUTO, output_channel, CTLTYPE_STRING|CTLFLAG_RWTUN|CTLFLAG_MPSAFE, NULL, 0, sysctl_debug_witness_channel, "A", "Output channel for warnings") | |
SYSCTL_PROC (_debug_witness, OID_AUTO, fullgraph, CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, 0, sysctl_debug_witness_fullgraph, "A", "Show locks relation graphs") | |
SYSCTL_PROC (_debug_witness, OID_AUTO, badstacks, CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, 0, sysctl_debug_witness_badstacks, "A", "Show bad witness stacks") | |
SYSCTL_INT (_debug_witness, OID_AUTO, free_cnt, CTLFLAG_RD, &w_free_cnt, 0, "") | |
SYSCTL_INT (_debug_witness, OID_AUTO, spin_cnt, CTLFLAG_RD, &w_spin_cnt, 0, "") | |
SYSCTL_INT (_debug_witness, OID_AUTO, sleep_cnt, CTLFLAG_RD, &w_sleep_cnt, 0, "") | |
static const char * | fixup_filename (const char *file) |
int | witness_startup_count (void) |
void | witness_startup (void *mem) |
void | witness_init (struct lock_object *lock, const char *type) |
void | witness_destroy (struct lock_object *lock) |
int | witness_defineorder (struct lock_object *lock1, struct lock_object *lock2) |
void | witness_checkorder (struct lock_object *lock, int flags, const char *file, int line, struct lock_object *interlock) |
void | witness_lock (struct lock_object *lock, int flags, const char *file, int line) |
void | witness_upgrade (struct lock_object *lock, int flags, const char *file, int line) |
void | witness_downgrade (struct lock_object *lock, int flags, const char *file, int line) |
void | witness_unlock (struct lock_object *lock, int flags, const char *file, int line) |
void | witness_thread_exit (struct thread *td) |
int | witness_warn (int flags, struct lock_object *lock, const char *fmt,...) |
const char * | witness_file (struct lock_object *lock) |
int | witness_line (struct lock_object *lock) |
int | witness_list_locks (struct lock_list_entry **lock_list, int(*prnt)(const char *fmt,...)) |
void | witness_display_spinlock (struct lock_object *lock, struct thread *owner, int(*prnt)(const char *fmt,...)) |
void | witness_save (struct lock_object *lock, const char **filep, int *linep) |
void | witness_restore (struct lock_object *lock, const char *file, int line) |
void | witness_assert (const struct lock_object *lock, int flags, const char *file, int line) |
void | witness_norelease (struct lock_object *lock) |
void | witness_releaseok (struct lock_object *lock) |
static void | sbuf_print_witness_badstacks (struct sbuf *sb, size_t *oldidx) |
Variables | |
static int | witness_watch = 1 |
int | witness_skipspin = 0 |
int | badstack_sbuf_size |
int | witness_count = WITNESS_COUNT |
static enum witness_channel | witness_channel = WITNESS_CONSOLE |
static struct mtx | w_mtx |
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_spin = STAILQ_HEAD_INITIALIZER(w_spin) |
static struct witness_list | w_sleep = STAILQ_HEAD_INITIALIZER(w_sleep) |
static struct lock_list_entry * | w_lock_list_free = NULL |
static struct witness_pendhelp | pending_locks [WITNESS_PENDLIST] |
static u_int | pending_cnt |
static int | w_free_cnt |
static int | w_spin_cnt |
static int | w_sleep_cnt |
static struct witness * | w_data |
static uint8_t ** | w_rmatrix |
static struct lock_list_entry | w_locklistdata [LOCK_CHILDCOUNT] |
static struct witness_hash | w_hash |
static struct witness_lock_order_data | w_lodata [WITNESS_LO_DATA_COUNT] |
static struct witness_lock_order_data * | w_lofree = NULL |
static struct witness_lock_order_hash | w_lohash |
static int | w_max_used_index = 0 |
static unsigned int | w_generation = 0 |
static const char | w_notrunning [] = "Witness not running\n" |
static const char | w_stillcold [] = "Witness is still cold\n" |
static struct witness_order_list_entry | order_lists [] |
static struct witness_blessed | blessed_list [] |
static int | witness_cold = 1 |
static int | witness_spin_warn = 0 |
#define FULLGRAPH_SBUF_SIZE 512 |
Definition at line 158 of file subr_witness.c.
#define KTR_WITNESS 0 |
Definition at line 128 of file subr_witness.c.
#define LI_EXCLUSIVE 0x00010000 /* Exclusive lock instance. */ |
Definition at line 132 of file subr_witness.c.
#define LI_NORELEASE 0x00020000 /* Lock not allowed to be released. */ |
Definition at line 133 of file subr_witness.c.
#define LI_RECURSEMASK 0x0000ffff /* Recursion depth of lock instance. */ |
Definition at line 131 of file subr_witness.c.
#define LI_SLEEPABLE 0x00040000 /* Lock may be held while sleeping. */ |
Definition at line 134 of file subr_witness.c.
#define LOCK_CHILDCOUNT 2048 |
Definition at line 154 of file subr_witness.c.
#define LOCK_NCHILDREN 5 |
Definition at line 153 of file subr_witness.c.
#define MAX_W_NAME 64 |
Definition at line 156 of file subr_witness.c.
#define WITNESS_ANCESTOR 0x02 /* Direct or indirect ancestor. */ |
Definition at line 166 of file subr_witness.c.
#define WITNESS_ANCESTOR_MASK (WITNESS_PARENT | WITNESS_ANCESTOR) |
Definition at line 169 of file subr_witness.c.
#define WITNESS_ATOD | ( | x | ) | (((x) & WITNESS_RELATED_MASK) << 2) |
Definition at line 182 of file subr_witness.c.
#define WITNESS_CHILD 0x04 /* Child, aka direct descendant. */ |
Definition at line 167 of file subr_witness.c.
#define WITNESS_COUNT 1536 |
Definition at line 137 of file subr_witness.c.
#define WITNESS_DESCENDANT 0x08 /* Direct or indirect descendant. */ |
Definition at line 168 of file subr_witness.c.
#define WITNESS_DESCENDANT_MASK (WITNESS_CHILD | WITNESS_DESCENDANT) |
Definition at line 170 of file subr_witness.c.
#define WITNESS_DTOA | ( | x | ) | (((x) & WITNESS_RELATED_MASK) >> 2) |
Definition at line 179 of file subr_witness.c.
#define WITNESS_HASH_SIZE 251 /* Prime, gives load factor < 2 */ |
Definition at line 139 of file subr_witness.c.
#define WITNESS_INDEX_ASSERT | ( | i | ) | MPASS((i) > 0 && (i) <= w_max_used_index && (i) < witness_count) |
Definition at line 184 of file subr_witness.c.
#define WITNESS_LO_DATA_COUNT 2048 |
Definition at line 143 of file subr_witness.c.
#define WITNESS_LO_HASH_SIZE 1021 |
Definition at line 146 of file subr_witness.c.
#define WITNESS_LOCK_ORDER_KNOWN 0x80 /* This lock order is known. */ |
Definition at line 176 of file subr_witness.c.
#define WITNESS_PARENT 0x01 /* Parent, aka direct ancestor. */ |
Definition at line 165 of file subr_witness.c.
#define WITNESS_PENDLIST (512 + (MAXCPU * 4)) |
Definition at line 140 of file subr_witness.c.
#define WITNESS_RELATED_MASK (WITNESS_ANCESTOR_MASK | WITNESS_DESCENDANT_MASK) |
Definition at line 171 of file subr_witness.c.
#define WITNESS_RESERVED1 0x20 /* Unused flag, reserved. */ |
Definition at line 174 of file subr_witness.c.
#define WITNESS_RESERVED2 0x40 /* Unused flag, reserved. */ |
Definition at line 175 of file subr_witness.c.
#define WITNESS_REVERSAL |
Definition at line 173 of file subr_witness.c.
#define WITNESS_UNRELATED 0x00 /* No lock order relation. */ |
Definition at line 164 of file subr_witness.c.
enum witness_channel |
Enumerator | |
---|---|
WITNESS_CONSOLE | |
WITNESS_LOG | |
WITNESS_NONE |
Definition at line 426 of file subr_witness.c.
__FBSDID | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 2087 of file subr_witness.c.
References kdb_backtrace(), printf(), witness::w_index, w_mtx, witness::w_name, w_rmatrix, WITNESS_ATOD, WITNESS_DTOA, WITNESS_INDEX_ASSERT, WITNESS_RELATED_MASK, and witness_watch.
Referenced by isitmychild(), and isitmydescendant().
Definition at line 1963 of file subr_witness.c.
References child, isitmychild(), kdb_backtrace(), parent, printf(), w_data, w_max_used_index, w_mtx, w_rmatrix, WITNESS_ANCESTOR, WITNESS_ANCESTOR_MASK, WITNESS_CHILD, witness_cold, WITNESS_DESCENDANT, WITNESS_DESCENDANT_MASK, witness_increment_graph_generation(), WITNESS_INDEX_ASSERT, WITNESS_PARENT, and witness_watch.
Referenced by itismychild().
Definition at line 2139 of file subr_witness.c.
References witness_blessed::b_lock1, witness_blessed::b_lock2, blessed_list, and witness::w_name.
Referenced by sbuf_print_witness_badstacks(), and witness_checkorder().
|
static |
Definition at line 1945 of file subr_witness.c.
References witness::w_class, w_sleep_cnt, w_spin_cnt, and witness_increment_graph_generation().
Referenced by witness_destroy().
|
static |
Definition at line 1890 of file subr_witness.c.
References MAX_W_NAME, w_all, witness::w_class, w_mtx, witness::w_name, w_sleep, w_sleep_cnt, w_spin, w_spin_cnt, witness_get(), witness_hash_get(), witness_hash_put(), witness_increment_graph_generation(), witness_skipspin, and witness_watch.
Referenced by witness_init(), and witness_startup().
|
static |
Definition at line 2230 of file subr_witness.c.
References lock_instance::li_lock, lock_list_entry::ll_children, lock_list_entry::ll_count, and lock_list_entry::ll_next.
Referenced by witness_assert(), witness_checkorder(), witness_display_spinlock(), witness_downgrade(), witness_lock(), witness_restore(), witness_save(), witness_setflag(), and witness_upgrade().
|
static |
Definition at line 757 of file subr_witness.c.
Referenced by witness_assert(), witness_checkorder(), witness_downgrade(), witness_list_lock(), witness_unlock(), and witness_upgrade().
Definition at line 2121 of file subr_witness.c.
References _isitmyx(), child, parent, and WITNESS_PARENT.
Referenced by adopt(), witness_checkorder(), and witness_lock_order_check().
Definition at line 2131 of file subr_witness.c.
References _isitmyx(), and WITNESS_ANCESTOR_MASK.
Referenced by witness_checkorder(), and witness_defineorder().
Definition at line 2056 of file subr_witness.c.
References adopt(), child, parent, w_mtx, witness_cold, and witness_lock_type_equal().
Referenced by witness_checkorder(), witness_defineorder(), and witness_startup().
|
static |
|
static |
Definition at line 2616 of file subr_witness.c.
References blessed(), free(), malloc(), sbuf_clear(), sbuf_printf(), stack_copy(), stack_sbuf_print(), stack_zero(), witness::w_class, w_data, w_generation, w_lohash, w_max_used_index, w_mtx, witness::w_name, w_rmatrix, witness_lock_order_get(), WITNESS_REVERSAL, witness_lock_order_data::wlod_stack, and witness_lock_order_hash::wloh_count.
Referenced by sysctl_debug_witness_badstacks().
STAILQ_HEAD | ( | witness_list | , |
witness | |||
) |
|
static |
Definition at line 2749 of file subr_witness.c.
References badstack_sbuf_size, sbuf_data(), sbuf_delete(), sbuf_finish(), sbuf_len(), sbuf_new(), sbuf_print_witness_badstacks(), w_notrunning, w_stillcold, witness_cold, and witness_watch.
|
static |
Definition at line 2798 of file subr_witness.c.
References buf, name, snprintf(), sysctl_handle_string(), WITNESS_CONSOLE, WITNESS_LOG, and WITNESS_NONE.
|
static |
Definition at line 2834 of file subr_witness.c.
References FULLGRAPH_SBUF_SIZE, sbuf_delete(), sbuf_finish(), sbuf_new_for_sysctl(), sbuf_printf(), sysctl_wire_old_buffer(), w_all, w_mtx, w_notrunning, w_stillcold, witness_add_fullgraph(), witness_cold, and witness_watch.
|
static |
Definition at line 2880 of file subr_witness.c.
References sysctl_handle_int(), value, and witness_watch.
SYSCTL_INT | ( | _debug_witness | , |
OID_AUTO | , | ||
free_cnt | , | ||
CTLFLAG_RD | , | ||
& | w_free_cnt, | ||
0 | , | ||
"" | |||
) |
SYSCTL_INT | ( | _debug_witness | , |
OID_AUTO | , | ||
skipspin | , | ||
CTLFLAG_RDTUN | , | ||
& | witness_skipspin, | ||
0 | , | ||
"" | |||
) |
SYSCTL_INT | ( | _debug_witness | , |
OID_AUTO | , | ||
sleep_cnt | , | ||
CTLFLAG_RD | , | ||
& | w_sleep_cnt, | ||
0 | , | ||
"" | |||
) |
SYSCTL_INT | ( | _debug_witness | , |
OID_AUTO | , | ||
spin_cnt | , | ||
CTLFLAG_RD | , | ||
& | w_spin_cnt, | ||
0 | , | ||
"" | |||
) |
SYSCTL_INT | ( | _debug_witness | , |
OID_AUTO | , | ||
witness_count | , | ||
CTLFLAG_RDTUN | , | ||
& | witness_count, | ||
0 | , | ||
"" | |||
) |
|
static |
SYSCTL_PROC | ( | _debug_witness | , |
OID_AUTO | , | ||
badstacks | , | ||
CTLTYPE_STRING|CTLFLAG_RD| | CTLFLAG_MPSAFE, | ||
NULL | , | ||
0 | , | ||
sysctl_debug_witness_badstacks | , | ||
"A" | , | ||
"Show bad witness stacks" | |||
) |
SYSCTL_PROC | ( | _debug_witness | , |
OID_AUTO | , | ||
fullgraph | , | ||
CTLTYPE_STRING|CTLFLAG_RD| | CTLFLAG_MPSAFE, | ||
NULL | , | ||
0 | , | ||
sysctl_debug_witness_fullgraph | , | ||
"A" | , | ||
"Show locks relation graphs" | |||
) |
SYSCTL_PROC | ( | _debug_witness | , |
OID_AUTO | , | ||
output_channel | , | ||
CTLTYPE_STRING|CTLFLAG_RWTUN| | CTLFLAG_MPSAFE, | ||
NULL | , | ||
0 | , | ||
sysctl_debug_witness_channel | , | ||
"A" | , | ||
"Output channel for warnings" | |||
) |
SYSCTL_PROC | ( | _debug_witness | , |
OID_AUTO | , | ||
watch | , | ||
CTLFLAG_RWTUN|CTLTYPE_INT| | CTLFLAG_MPSAFE, | ||
NULL | , | ||
0 | , | ||
sysctl_debug_witness_watch | , | ||
"I" | , | ||
"witness is watching lock operations" | |||
) |
|
static |
Definition at line 2896 of file subr_witness.c.
References sbuf_printf(), w_data, witness::w_index, w_max_used_index, witness::w_name, w_rmatrix, witness_add_fullgraph(), WITNESS_INDEX_ASSERT, and WITNESS_PARENT.
Referenced by sysctl_debug_witness_fullgraph(), and witness_add_fullgraph().
void witness_assert | ( | const struct lock_object * | lock, |
int | flags, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 2426 of file subr_witness.c.
References find_instance(), fixup_filename(), flags, LI_EXCLUSIVE, lock_instance::li_flags, LI_RECURSEMASK, and witness_watch.
void witness_checkorder | ( | struct lock_object * | lock, |
int | flags, | ||
const char * | file, | ||
int | line, | ||
struct lock_object * | interlock | ||
) |
Definition at line 1109 of file subr_witness.c.
References blessed(), buf, data, find_instance(), fixup_filename(), flags, Giant, isitmychild(), isitmydescendant(), itismychild(), kdb_active, KTR_WITNESS, LI_EXCLUSIVE, lock_instance::li_file, lock_instance::li_flags, lock_instance::li_line, lock_instance::li_lock, LI_RECURSEMASK, LI_SLEEPABLE, lock_list_entry::ll_children, lock_list_entry::ll_count, lock_list_entry::ll_next, LOCK_CHILDCOUNT, LOCK_NCHILDREN, sbuf_delete(), sbuf_finish(), sbuf_new(), sbuf_printf(), sbuf_set_drain(), stack_copy(), stack_sbuf_print_flags(), witness::w_class, witness::w_index, w_mtx, witness::w_name, w_rmatrix, witness_cold, witness_debugger(), witness_enter_debugger(), witness_increment_graph_generation(), witness_lock_order_add(), witness_lock_order_check(), witness_lock_order_get(), witness_output(), witness_output_drain(), and WITNESS_REVERSAL.
|
static |
Definition at line 3107 of file subr_witness.c.
References buf, sbuf_finish(), sbuf_new(), sbuf_set_drain(), st, stack_zero(), witness_enter_debugger(), witness_output(), and witness_output_drain().
Referenced by witness_checkorder(), and witness_warn().
int witness_defineorder | ( | struct lock_object * | lock1, |
struct lock_object * | lock2 | ||
) |
Definition at line 1076 of file subr_witness.c.
References isitmydescendant(), itismychild(), KTR_WITNESS, w_mtx, and witness_watch.
void witness_destroy | ( | struct lock_object * | lock | ) |
Definition at line 917 of file subr_witness.c.
References depart(), panic(), w_mtx, and witness_cold.
void witness_display_spinlock | ( | struct lock_object * | lock, |
struct thread * | owner, | ||
int(*)(const char *fmt,...) | prnt | ||
) |
Definition at line 2339 of file subr_witness.c.
References find_instance(), pcpu_find(), and witness_list_lock().
Referenced by _mtx_lock_indefinite_check().
void witness_downgrade | ( | struct lock_object * | lock, |
int | flags, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 1608 of file subr_witness.c.
References find_instance(), fixup_filename(), LI_EXCLUSIVE, lock_instance::li_flags, LI_RECURSEMASK, witness_cold, and witness_watch.
|
static |
Definition at line 3132 of file subr_witness.c.
References kdb_enter().
Referenced by witness_checkorder(), and witness_debugger().
const char * witness_file | ( | struct lock_object * | lock | ) |
Definition at line 1868 of file subr_witness.c.
References witness_cold.
|
static |
Definition at line 2191 of file subr_witness.c.
References w_free, and w_free_cnt.
Referenced by witness_startup().
|
static |
Definition at line 2159 of file subr_witness.c.
References printf(), w_free, w_free_cnt, witness::w_index, w_max_used_index, w_mtx, witness_cold, witness_count, and witness_watch.
Referenced by enroll().
|
static |
Definition at line 2921 of file subr_witness.c.
Referenced by witness_hash_get(), witness_hash_put(), witness_lock_order_add(), and witness_lock_order_get().
|
static |
Definition at line 2969 of file subr_witness.c.
References w_hash, w_mtx, witness::w_name, witness_hash::wh_array, witness_hash::wh_size, witness_cold, and witness_hash_djb2().
Referenced by enroll(), and witness_hash_put().
|
static |
Definition at line 2990 of file subr_witness.c.
References w_hash, w_mtx, witness::w_name, witness_hash::wh_array, witness_hash::wh_count, witness_hash::wh_size, witness_cold, witness_hash_djb2(), and witness_hash_get().
Referenced by enroll().
|
static |
Definition at line 3090 of file subr_witness.c.
References w_generation, w_mtx, and witness_cold.
Referenced by adopt(), depart(), enroll(), and witness_checkorder().
void witness_init | ( | struct lock_object * | lock, |
const char * | type | ||
) |
Definition at line 876 of file subr_witness.c.
References enroll(), panic(), pending_cnt, pending_locks, type, witness_pendhelp::wh_lock, witness_pendhelp::wh_type, witness_cold, WITNESS_PENDLIST, and witness_watch.
|
static |
Definition at line 2942 of file subr_witness.c.
References w_hash, w_lodata, w_lofree, w_lohash, witness_hash::wh_array, witness_hash::wh_count, witness_hash::wh_size, witness_cold, WITNESS_HASH_SIZE, WITNESS_LO_DATA_COUNT, WITNESS_LO_HASH_SIZE, witness_lock_order_data::wlod_next, witness_lock_order_hash::wloh_array, witness_lock_order_hash::wloh_count, and witness_lock_order_hash::wloh_size.
Referenced by witness_startup().
int witness_line | ( | struct lock_object * | lock | ) |
Definition at line 1879 of file subr_witness.c.
References witness_cold.
|
static |
Definition at line 2246 of file subr_witness.c.
References fixup_filename(), LI_EXCLUSIVE, lock_instance::li_file, lock_instance::li_flags, lock_instance::li_line, lock_instance::li_lock, and LI_RECURSEMASK.
Referenced by witness_display_spinlock(), witness_list_locks(), witness_thread_exit(), and witness_warn().
int witness_list_locks | ( | struct lock_list_entry ** | lock_list, |
int(*)(const char *fmt,...) | prnt | ||
) |
Definition at line 2316 of file subr_witness.c.
References lock_list_entry::ll_children, lock_list_entry::ll_count, lock_list_entry::ll_next, and witness_list_lock().
Referenced by witness_warn().
void witness_lock | ( | struct lock_object * | lock, |
int | flags, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 1503 of file subr_witness.c.
References find_instance(), flags, KTR_WITNESS, LI_EXCLUSIVE, lock_instance::li_file, lock_instance::li_flags, lock_instance::li_line, lock_instance::li_lock, LI_RECURSEMASK, LI_SLEEPABLE, lock_list_entry::ll_children, lock_list_entry::ll_count, lock_list_entry::ll_next, LOCK_NCHILDREN, witness_cold, witness_lock_list_get(), and witness_watch.
|
static |
Definition at line 2220 of file subr_witness.c.
References lock_list_entry::ll_next, w_lock_list_free, and w_mtx.
Referenced by witness_startup(), witness_thread_exit(), and witness_unlock().
|
static |
Definition at line 2199 of file subr_witness.c.
References lock_list_entry::ll_next, printf(), w_lock_list_free, w_mtx, and witness_watch.
Referenced by witness_lock().
Definition at line 3057 of file subr_witness.c.
References child, data, witness_lock_order_key::from, parent, stack_zero(), witness_lock_order_key::to, w_lofree, w_lohash, w_rmatrix, witness_hash_djb2(), WITNESS_INDEX_ASSERT, WITNESS_LOCK_ORDER_KNOWN, witness_lock_order_hash::wloh_array, witness_lock_order_hash::wloh_count, and witness_lock_order_hash::wloh_size.
Referenced by witness_checkorder().
Definition at line 3044 of file subr_witness.c.
References child, isitmychild(), parent, w_rmatrix, and WITNESS_LOCK_ORDER_KNOWN.
Referenced by witness_checkorder().
|
static |
Definition at line 3010 of file subr_witness.c.
References child, data, witness_lock_order_key::from, parent, witness_lock_order_key::to, w_lohash, w_rmatrix, witness_hash_djb2(), WITNESS_INDEX_ASSERT, witness_lock_order_key_equal(), WITNESS_LOCK_ORDER_KNOWN, witness_lock_order_hash::wloh_array, and witness_lock_order_hash::wloh_size.
Referenced by sbuf_print_witness_badstacks(), and witness_checkorder().
|
static |
Definition at line 306 of file subr_witness.c.
References witness_lock_order_key::from, and witness_lock_order_key::to.
Referenced by witness_lock_order_get().
Definition at line 298 of file subr_witness.c.
References witness::w_class.
Referenced by itismychild().
void witness_norelease | ( | struct lock_object * | lock | ) |
Definition at line 2528 of file subr_witness.c.
References LI_NORELEASE, and witness_setflag().
|
static |
Definition at line 2262 of file subr_witness.c.
References witness_voutput().
Referenced by witness_checkorder(), witness_debugger(), witness_output_drain(), witness_thread_exit(), and witness_unlock().
|
static |
Definition at line 3099 of file subr_witness.c.
References data, and witness_output().
Referenced by witness_checkorder(), and witness_debugger().
void witness_releaseok | ( | struct lock_object * | lock | ) |
Definition at line 2535 of file subr_witness.c.
References LI_NORELEASE, and witness_setflag().
void witness_restore | ( | struct lock_object * | lock, |
const char * | file, | ||
int | line | ||
) |
Definition at line 2389 of file subr_witness.c.
References find_instance(), lock_instance::li_file, lock_instance::li_line, witness_cold, witness_skipspin, and witness_watch.
void witness_save | ( | struct lock_object * | lock, |
const char ** | filep, | ||
int * | linep | ||
) |
Definition at line 2354 of file subr_witness.c.
References find_instance(), lock_instance::li_file, lock_instance::li_line, witness_cold, witness_skipspin, and witness_watch.
|
static |
Definition at line 2498 of file subr_witness.c.
References find_instance(), flag, lock_instance::li_flags, set, witness_skipspin, and witness_watch.
Referenced by witness_norelease(), and witness_releaseok().
void witness_startup | ( | void * | mem | ) |
Definition at line 789 of file subr_witness.c.
References badstack_sbuf_size, enroll(), Giant, itismychild(), KTR_WITNESS, LOCK_CHILDCOUNT, order_lists, pending_locks, witness_order_list_entry::w_class, w_data, w_free, w_free_cnt, witness::w_index, w_locklistdata, w_mtx, witness_order_list_entry::w_name, w_rmatrix, witness_pendhelp::wh_lock, witness_cold, witness_count, witness_free(), witness_init_hash_tables(), witness_lock_list_free(), and witness_spin_warn.
int witness_startup_count | ( | void | ) |
Definition at line 771 of file subr_witness.c.
References w_rmatrix, and witness_count.
void witness_thread_exit | ( | struct thread * | td | ) |
Definition at line 1763 of file subr_witness.c.
References lock_list_entry::ll_children, lock_list_entry::ll_count, lock_list_entry::ll_next, witness_list_lock(), witness_lock_list_free(), and witness_output().
Referenced by thread_exit().
void witness_unlock | ( | struct lock_object * | lock, |
int | flags, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 1654 of file subr_witness.c.
References fixup_filename(), flags, KTR_WITNESS, LI_EXCLUSIVE, lock_instance::li_file, lock_instance::li_flags, lock_instance::li_line, lock_instance::li_lock, LI_NORELEASE, LI_RECURSEMASK, lock_list_entry::ll_next, witness_cold, witness_lock_list_free(), witness_output(), and witness_watch.
void witness_upgrade | ( | struct lock_object * | lock, |
int | flags, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 1563 of file subr_witness.c.
References find_instance(), fixup_filename(), LI_EXCLUSIVE, lock_instance::li_flags, LI_RECURSEMASK, witness_cold, and witness_watch.
|
static |
Definition at line 2274 of file subr_witness.c.
References vlog(), vprintf(), WITNESS_CONSOLE, WITNESS_LOG, and WITNESS_NONE.
Referenced by witness_output().
int witness_warn | ( | int | flags, |
struct lock_object * | lock, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 1796 of file subr_witness.c.
References flags, Giant, lock_instance::li_flags, lock_instance::li_lock, LI_SLEEPABLE, lock_list_entry::ll_children, lock_list_entry::ll_count, lock_list_entry::ll_next, printf(), vprintf(), witness_cold, witness_debugger(), witness_list_lock(), witness_list_locks(), and witness_watch.
int badstack_sbuf_size |
Definition at line 417 of file subr_witness.c.
Referenced by sysctl_debug_witness_badstacks(), and witness_startup().
|
static |
Definition at line 729 of file subr_witness.c.
Referenced by blessed().
|
static |
Definition at line 492 of file subr_witness.c.
Referenced by witness_startup().
|
static |
Definition at line 467 of file subr_witness.c.
Referenced by witness_init().
|
static |
Definition at line 466 of file subr_witness.c.
Referenced by witness_init(), and witness_startup().
|
static |
Definition at line 458 of file subr_witness.c.
Referenced by enroll(), and sysctl_debug_witness_fullgraph().
|
static |
Definition at line 475 of file subr_witness.c.
Referenced by adopt(), sbuf_print_witness_badstacks(), witness_add_fullgraph(), and witness_startup().
|
static |
Definition at line 457 of file subr_witness.c.
Referenced by witness_free(), witness_get(), and witness_startup().
|
static |
Definition at line 469 of file subr_witness.c.
Referenced by witness_free(), witness_get(), and witness_startup().
|
static |
Definition at line 485 of file subr_witness.c.
Referenced by sbuf_print_witness_badstacks(), and witness_increment_graph_generation().
|
static |
Definition at line 478 of file subr_witness.c.
Referenced by witness_hash_get(), witness_hash_put(), and witness_init_hash_tables().
|
static |
Definition at line 465 of file subr_witness.c.
Referenced by witness_lock_list_free(), and witness_lock_list_get().
|
static |
Definition at line 477 of file subr_witness.c.
Referenced by witness_startup().
|
static |
Definition at line 481 of file subr_witness.c.
Referenced by witness_init_hash_tables().
|
static |
Definition at line 482 of file subr_witness.c.
Referenced by witness_init_hash_tables(), and witness_lock_order_add().
|
static |
Definition at line 483 of file subr_witness.c.
Referenced by sbuf_print_witness_badstacks(), witness_init_hash_tables(), witness_lock_order_add(), and witness_lock_order_get().
|
static |
Definition at line 484 of file subr_witness.c.
Referenced by adopt(), sbuf_print_witness_badstacks(), witness_add_fullgraph(), and witness_get().
|
static |
Definition at line 454 of file subr_witness.c.
Referenced by _isitmyx(), adopt(), enroll(), itismychild(), sbuf_print_witness_badstacks(), sysctl_debug_witness_fullgraph(), witness_checkorder(), witness_defineorder(), witness_destroy(), witness_get(), witness_hash_get(), witness_hash_put(), witness_increment_graph_generation(), witness_lock_list_free(), witness_lock_list_get(), and witness_startup().
|
static |
Definition at line 486 of file subr_witness.c.
Referenced by sysctl_debug_witness_badstacks(), and sysctl_debug_witness_fullgraph().
|
static |
Definition at line 476 of file subr_witness.c.
Referenced by _isitmyx(), adopt(), sbuf_print_witness_badstacks(), witness_add_fullgraph(), witness_checkorder(), witness_lock_order_add(), witness_lock_order_check(), witness_lock_order_get(), witness_startup(), and witness_startup_count().
|
static |
Definition at line 462 of file subr_witness.c.
Referenced by enroll().
|
static |
Definition at line 469 of file subr_witness.c.
|
static |
Definition at line 461 of file subr_witness.c.
Referenced by enroll().
|
static |
Definition at line 469 of file subr_witness.c.
|
static |
Definition at line 487 of file subr_witness.c.
Referenced by sysctl_debug_witness_badstacks(), and sysctl_debug_witness_fullgraph().
|
static |
Definition at line 432 of file subr_witness.c.
|
static |
Definition at line 747 of file subr_witness.c.
Referenced by adopt(), itismychild(), sysctl_debug_witness_badstacks(), sysctl_debug_witness_fullgraph(), witness_checkorder(), witness_destroy(), witness_downgrade(), witness_file(), witness_get(), witness_hash_get(), witness_hash_put(), witness_increment_graph_generation(), witness_init(), witness_init_hash_tables(), witness_line(), witness_lock(), witness_restore(), witness_save(), witness_startup(), witness_unlock(), witness_upgrade(), and witness_warn().
int witness_count = WITNESS_COUNT |
Definition at line 419 of file subr_witness.c.
Referenced by witness_get(), witness_startup(), and witness_startup_count().
int witness_skipspin = 0 |
Definition at line 413 of file subr_witness.c.
Referenced by enroll(), witness_restore(), witness_save(), and witness_setflag().
|
static |
Definition at line 753 of file subr_witness.c.
Referenced by witness_startup().
|
static |
Definition at line 378 of file subr_witness.c.
Referenced by _isitmyx(), adopt(), enroll(), sysctl_debug_witness_badstacks(), sysctl_debug_witness_fullgraph(), sysctl_debug_witness_watch(), witness_assert(), witness_defineorder(), witness_downgrade(), witness_get(), witness_init(), witness_lock(), witness_lock_list_get(), witness_restore(), witness_save(), witness_setflag(), witness_unlock(), witness_upgrade(), and witness_warn().