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/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_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 | WITNESS_COUNT 1024 |
#define | WITNESS_CHILDCOUNT (WITNESS_COUNT * 4) |
#define | WITNESS_HASH_SIZE 251 /* Prime, gives load factor < 2 */ |
#define | WITNESS_PENDLIST 768 |
#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 | BADSTACK_SBUF_SIZE (256 * WITNESS_COUNT) |
#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) |
#define | witness_debugger(c) |
Functions | |
__FBSDID ("$BSDSUniX$") | |
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 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, 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 void | witness_add_fullgraph (struct sbuf *sb, struct witness *parent) |
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 void | witness_setflag (struct lock_object *lock, int flag, int set) |
static | SYSCTL_NODE (_debug, OID_AUTO, witness, CTLFLAG_RW, NULL,"Witness Locking") |
TUNABLE_INT ("debug.witness.watch",&witness_watch) | |
SYSCTL_PROC (_debug_witness, OID_AUTO, watch, CTLFLAG_RW|CTLTYPE_INT, NULL, 0, sysctl_debug_witness_watch,"I","witness is watching lock operations") | |
TUNABLE_INT ("debug.witness.skipspin",&witness_skipspin) | |
SYSCTL_INT (_debug_witness, OID_AUTO, skipspin, CTLFLAG_RDTUN,&witness_skipspin, 0,"") | |
SYSCTL_PROC (_debug_witness, OID_AUTO, fullgraph, CTLTYPE_STRING|CTLFLAG_RD, NULL, 0, sysctl_debug_witness_fullgraph,"A","Show locks relation graphs") | |
SYSCTL_PROC (_debug_witness, OID_AUTO, badstacks, CTLTYPE_STRING|CTLFLAG_RD, 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) |
static void | witness_initialize (void *dummy __unused) |
SYSINIT (witness_init, SI_SUB_WITNESS, SI_ORDER_FIRST, witness_initialize, NULL) | |
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 (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) |
Variables | |
static int | witness_watch = 1 |
int | witness_skipspin = 0 |
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 [WITNESS_COUNT+1][WITNESS_COUNT+1] |
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 int | witness_cold = 1 |
static int | witness_spin_warn = 0 |
#define BADSTACK_SBUF_SIZE (256 * WITNESS_COUNT) |
Definition at line 156 of file subr_witness.c.
Referenced by sysctl_debug_witness_badstacks().
#define FULLGRAPH_SBUF_SIZE 512 |
Definition at line 157 of file subr_witness.c.
Referenced by sysctl_debug_witness_fullgraph().
#define KTR_WITNESS 0 |
Definition at line 125 of file subr_witness.c.
Referenced by witness_checkorder(), witness_defineorder(), witness_initialize(), witness_lock(), and witness_unlock().
#define LI_EXCLUSIVE 0x00010000 /* Exclusive lock instance. */ |
Definition at line 129 of file subr_witness.c.
Referenced by witness_assert(), witness_checkorder(), witness_downgrade(), witness_list_lock(), witness_lock(), witness_unlock(), and witness_upgrade().
#define LI_NORELEASE 0x00020000 /* Lock not allowed to be released. */ |
Definition at line 130 of file subr_witness.c.
Referenced by witness_norelease(), witness_releaseok(), and witness_unlock().
#define LI_RECURSEMASK 0x0000ffff /* Recursion depth of lock instance. */ |
Definition at line 128 of file subr_witness.c.
Referenced by witness_assert(), witness_downgrade(), witness_list_lock(), witness_lock(), witness_unlock(), and witness_upgrade().
#define LOCK_CHILDCOUNT 2048 |
Definition at line 152 of file subr_witness.c.
Referenced by witness_initialize().
#define LOCK_NCHILDREN 5 |
Definition at line 151 of file subr_witness.c.
Referenced by witness_checkorder(), and witness_lock().
#define MAX_W_NAME 64 |
Definition at line 154 of file subr_witness.c.
Referenced by enroll().
#define WITNESS_ANCESTOR 0x02 /* Direct or indirect ancestor. */ |
Definition at line 165 of file subr_witness.c.
Referenced by adopt().
#define WITNESS_ANCESTOR_MASK (WITNESS_PARENT | WITNESS_ANCESTOR) |
Definition at line 168 of file subr_witness.c.
Referenced by adopt(), and isitmydescendant().
#define WITNESS_ATOD | ( | x | ) | (((x) & WITNESS_RELATED_MASK) << 2) |
Definition at line 182 of file subr_witness.c.
Referenced by _isitmyx().
#define WITNESS_CHILD 0x04 /* Child, aka direct descendant. */ |
Definition at line 166 of file subr_witness.c.
Referenced by adopt().
#define WITNESS_CHILDCOUNT (WITNESS_COUNT * 4) |
Definition at line 136 of file subr_witness.c.
#define WITNESS_COUNT 1024 |
Definition at line 135 of file subr_witness.c.
Referenced by witness_checkorder(), witness_get(), and witness_initialize().
#define witness_debugger | ( | c | ) |
Definition at line 369 of file subr_witness.c.
Referenced by witness_checkorder(), and witness_warn().
#define WITNESS_DESCENDANT 0x08 /* Direct or indirect descendant. */ |
Definition at line 167 of file subr_witness.c.
Referenced by adopt().
#define WITNESS_DESCENDANT_MASK (WITNESS_CHILD | WITNESS_DESCENDANT) |
Definition at line 169 of file subr_witness.c.
Referenced by adopt().
#define WITNESS_DTOA | ( | x | ) | (((x) & WITNESS_RELATED_MASK) >> 2) |
Definition at line 179 of file subr_witness.c.
Referenced by _isitmyx().
#define WITNESS_HASH_SIZE 251 /* Prime, gives load factor < 2 */ |
Definition at line 137 of file subr_witness.c.
Referenced by witness_init_hash_tables().
#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.
Referenced by _isitmyx(), adopt(), witness_add_fullgraph(), witness_lock_order_add(), and witness_lock_order_get().
#define WITNESS_LO_DATA_COUNT 2048 |
Definition at line 141 of file subr_witness.c.
Referenced by witness_init_hash_tables().
#define WITNESS_LO_HASH_SIZE 1021 |
Definition at line 144 of file subr_witness.c.
Referenced by witness_init_hash_tables().
#define WITNESS_LOCK_ORDER_KNOWN 0x80 /* This lock order is known. */ |
Definition at line 176 of file subr_witness.c.
Referenced by witness_lock_order_add(), witness_lock_order_check(), and witness_lock_order_get().
#define WITNESS_PARENT 0x01 /* Parent, aka direct ancestor. */ |
Definition at line 164 of file subr_witness.c.
Referenced by adopt(), isitmychild(), and witness_add_fullgraph().
#define WITNESS_PENDLIST 768 |
Definition at line 138 of file subr_witness.c.
Referenced by witness_init().
#define WITNESS_RELATED_MASK (WITNESS_ANCESTOR_MASK | WITNESS_DESCENDANT_MASK) |
Definition at line 170 of file subr_witness.c.
Referenced by _isitmyx().
#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 172 of file subr_witness.c.
Referenced by sysctl_debug_witness_badstacks(), and witness_checkorder().
#define WITNESS_UNRELATED 0x00 /* No lock order relation. */ |
Definition at line 163 of file subr_witness.c.
__FBSDID | ( | "$BSDSUniX$" | ) |
|
static |
Definition at line 1930 of file subr_witness.c.
References kdb_backtrace(), printf(), witness::w_index, witness::w_name, WITNESS_ATOD, WITNESS_DTOA, WITNESS_INDEX_ASSERT, and WITNESS_RELATED_MASK.
Referenced by isitmychild(), and isitmydescendant().
Definition at line 1813 of file subr_witness.c.
References isitmychild(), kdb_backtrace(), printf(), witness::w_index, w_max_used_index, w_mtx, WITNESS_ANCESTOR, WITNESS_ANCESTOR_MASK, WITNESS_CHILD, WITNESS_DESCENDANT, WITNESS_DESCENDANT_MASK, witness_increment_graph_generation(), WITNESS_INDEX_ASSERT, and WITNESS_PARENT.
Referenced by itismychild().
|
static |
Definition at line 1791 of file subr_witness.c.
References witness::w_class, w_sleep, w_spin, and witness_increment_graph_generation().
Referenced by witness_destroy().
|
static |
Definition at line 1735 of file subr_witness.c.
References MAX_W_NAME, panic(), panicstr, witness::w_class, w_mtx, witness::w_name, w_sleep, w_spin, witness_get(), witness_hash_get(), witness_hash_put(), and witness_increment_graph_generation().
Referenced by witness_init(), and witness_initialize().
|
static |
Definition at line 2072 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 721 of file subr_witness.c.
Referenced by witness_assert(), witness_checkorder(), witness_downgrade(), witness_list_lock(), witness_unlock(), and witness_upgrade().
Definition at line 1961 of file subr_witness.c.
References _isitmyx(), and WITNESS_PARENT.
Referenced by adopt(), witness_checkorder(), and witness_lock_order_check().
Definition at line 1971 of file subr_witness.c.
References _isitmyx(), and WITNESS_ANCESTOR_MASK.
Referenced by witness_checkorder(), and witness_defineorder().
Definition at line 1907 of file subr_witness.c.
References adopt(), panic(), witness::w_class, w_mtx, witness::w_name, and witness_lock_type_equal().
Referenced by witness_checkorder(), witness_defineorder(), and witness_initialize().
|
static |
STAILQ_HEAD | ( | witness_list | , |
witness | |||
) |
|
static |
Definition at line 2418 of file subr_witness.c.
References BADSTACK_SBUF_SIZE, free(), malloc(), sbuf_clear(), sbuf_data(), sbuf_delete(), sbuf_finish(), sbuf_len(), sbuf_new(), sbuf_printf(), stack_copy(), stack_sbuf_print(), stack_zero(), witness::w_class, w_generation, w_lohash, w_max_used_index, w_mtx, witness::w_name, witness_lock_order_get(), WITNESS_REVERSAL, witness_lock_order_data::wlod_stack, and witness_lock_order_hash::wloh_count.
|
static |
Definition at line 2576 of file subr_witness.c.
References FULLGRAPH_SBUF_SIZE, sbuf_delete(), sbuf_finish(), sbuf_new_for_sysctl(), sbuf_printf(), sysctl_wire_old_buffer(), w_mtx, and witness_add_fullgraph().
|
static |
Definition at line 2617 of file subr_witness.c.
References sysctl_handle_int(), value, and witness_watch.
SYSCTL_INT | ( | _debug_witness | , |
OID_AUTO | , | ||
skipspin | , | ||
CTLFLAG_RDTUN | , | ||
& | witness_skipspin, | ||
0 | , | ||
"" | |||
) |
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 |
SYSCTL_PROC | ( | _debug_witness | , |
OID_AUTO | , | ||
watch | , | ||
CTLFLAG_RW| | CTLTYPE_INT, | ||
NULL | , | ||
0 | , | ||
sysctl_debug_witness_watch | , | ||
"I" | , | ||
"witness is watching lock operations" | |||
) |
SYSCTL_PROC | ( | _debug_witness | , |
OID_AUTO | , | ||
fullgraph | , | ||
CTLTYPE_STRING| | CTLFLAG_RD, | ||
NULL | , | ||
0 | , | ||
sysctl_debug_witness_fullgraph | , | ||
"A" | , | ||
"Show locks relation graphs" | |||
) |
SYSCTL_PROC | ( | _debug_witness | , |
OID_AUTO | , | ||
badstacks | , | ||
CTLTYPE_STRING| | CTLFLAG_RD, | ||
NULL | , | ||
0 | , | ||
sysctl_debug_witness_badstacks | , | ||
"A" | , | ||
"Show bad witness stacks" | |||
) |
SYSINIT | ( | witness_init | , |
SI_SUB_WITNESS | , | ||
SI_ORDER_FIRST | , | ||
witness_initialize | , | ||
NULL | |||
) |
TUNABLE_INT | ( | "debug.witness.watch" | , |
& | witness_watch | ||
) |
TUNABLE_INT | ( | "debug.witness.skipspin" | , |
& | witness_skipspin | ||
) |
|
static |
Definition at line 2633 of file subr_witness.c.
References sbuf_printf(), witness::w_index, w_max_used_index, witness::w_name, WITNESS_INDEX_ASSERT, and WITNESS_PARENT.
Referenced by sysctl_debug_witness_fullgraph().
void witness_assert | ( | struct lock_object * | lock, |
int | flags, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 2233 of file subr_witness.c.
References find_instance(), fixup_filename(), LI_EXCLUSIVE, lock_instance::li_flags, LI_RECURSEMASK, panic(), and panicstr.
void witness_checkorder | ( | struct lock_object * | lock, |
int | flags, | ||
const char * | file, | ||
int | line, | ||
struct lock_object * | interlock | ||
) |
Definition at line 1046 of file subr_witness.c.
References find_instance(), fixup_filename(), 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, lock_list_entry::ll_children, lock_list_entry::ll_count, lock_list_entry::ll_next, LOCK_NCHILDREN, panic(), panicstr, printf(), witness::w_index, w_mtx, witness::w_name, WITNESS_COUNT, witness_debugger, witness_increment_graph_generation(), witness_lock_order_add(), witness_lock_order_check(), and WITNESS_REVERSAL.
int witness_defineorder | ( | struct lock_object * | lock1, |
struct lock_object * | lock2 | ||
) |
Definition at line 1013 of file subr_witness.c.
References isitmydescendant(), itismychild(), KTR_WITNESS, panicstr, and w_mtx.
void witness_destroy | ( | struct lock_object * | lock | ) |
Definition at line 853 of file subr_witness.c.
References depart(), panic(), and w_mtx.
void witness_display_spinlock | ( | struct lock_object * | lock, |
struct thread * | owner, | ||
int(*)(const char *fmt,...) | prnt | ||
) |
Definition at line 2150 of file subr_witness.c.
References find_instance(), pcpu_find(), and witness_list_lock().
Referenced by _mtx_lock_spin_failed().
void witness_downgrade | ( | struct lock_object * | lock, |
int | flags, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 1460 of file subr_witness.c.
References find_instance(), fixup_filename(), LI_EXCLUSIVE, lock_instance::li_flags, LI_RECURSEMASK, panic(), and panicstr.
const char* witness_file | ( | struct lock_object * | lock | ) |
Definition at line 1713 of file subr_witness.c.
|
static |
Definition at line 2033 of file subr_witness.c.
Referenced by witness_initialize().
|
static |
Definition at line 2001 of file subr_witness.c.
References printf(), witness::w_index, w_mtx, and WITNESS_COUNT.
Referenced by enroll().
|
static |
Definition at line 2658 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 2707 of file subr_witness.c.
References w_hash, w_mtx, witness::w_name, witness_hash::wh_array, witness_hash::wh_size, and witness_hash_djb2().
Referenced by enroll(), and witness_hash_put().
|
static |
Definition at line 2728 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_hash_djb2(), and witness_hash_get().
Referenced by enroll().
|
static |
Definition at line 2829 of file subr_witness.c.
References w_mtx.
Referenced by adopt(), depart(), enroll(), and witness_checkorder().
void witness_init | ( | struct lock_object * | lock, |
const char * | type | ||
) |
Definition at line 813 of file subr_witness.c.
References enroll(), panic(), panicstr, pending_cnt, pending_locks, type, witness_pendhelp::wh_lock, witness_pendhelp::wh_type, and WITNESS_PENDLIST.
|
static |
Definition at line 2680 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_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_initialize().
|
static |
Definition at line 737 of file subr_witness.c.
References enroll(), Giant, itismychild(), KTR_WITNESS, LOCK_CHILDCOUNT, malloc(), mtx_init(), pending_locks, witness_order_list_entry::w_class, witness::w_index, w_locklistdata, w_mtx, witness_order_list_entry::w_name, witness_pendhelp::wh_lock, WITNESS_COUNT, witness_free(), witness_init_hash_tables(), and witness_lock_list_free().
int witness_line | ( | struct lock_object * | lock | ) |
Definition at line 1724 of file subr_witness.c.
|
static |
Definition at line 2088 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 2127 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 1362 of file subr_witness.c.
References find_instance(), KTR_WITNESS, LI_EXCLUSIVE, lock_instance::li_file, lock_instance::li_flags, lock_instance::li_line, lock_instance::li_lock, LI_RECURSEMASK, lock_list_entry::ll_children, lock_list_entry::ll_count, lock_list_entry::ll_next, LOCK_NCHILDREN, panicstr, and witness_lock_list_get().
|
static |
Definition at line 2062 of file subr_witness.c.
References lock_list_entry::ll_next, w_lock_list_free, and w_mtx.
Referenced by witness_initialize(), witness_thread_exit(), and witness_unlock().
|
static |
Definition at line 2041 of file subr_witness.c.
References lock_list_entry::ll_next, printf(), w_lock_list_free, and w_mtx.
Referenced by witness_lock().
Definition at line 2796 of file subr_witness.c.
References witness_lock_order_key::from, stack_zero(), witness_lock_order_key::to, witness::w_index, w_lofree, w_lohash, witness_hash_djb2(), WITNESS_INDEX_ASSERT, WITNESS_LOCK_ORDER_KNOWN, witness_lock_order_data::wlod_key, witness_lock_order_data::wlod_next, witness_lock_order_data::wlod_stack, 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 2783 of file subr_witness.c.
References isitmychild(), witness::w_index, and WITNESS_LOCK_ORDER_KNOWN.
Referenced by witness_checkorder().
|
static |
Definition at line 2749 of file subr_witness.c.
References witness_lock_order_key::from, witness_lock_order_key::to, witness::w_index, w_lohash, witness_hash_djb2(), WITNESS_INDEX_ASSERT, witness_lock_order_key_equal(), WITNESS_LOCK_ORDER_KNOWN, witness_lock_order_data::wlod_key, witness_lock_order_data::wlod_next, witness_lock_order_hash::wloh_array, and witness_lock_order_hash::wloh_size.
Referenced by sysctl_debug_witness_badstacks().
|
static |
Definition at line 308 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 300 of file subr_witness.c.
References witness::w_class.
Referenced by itismychild().
void witness_norelease | ( | struct lock_object * | lock | ) |
Definition at line 2330 of file subr_witness.c.
References LI_NORELEASE, and witness_setflag().
void witness_releaseok | ( | struct lock_object * | lock | ) |
Definition at line 2337 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 2198 of file subr_witness.c.
References find_instance(), lock_instance::li_file, lock_instance::li_line, panic(), and panicstr.
void witness_save | ( | struct lock_object * | lock, |
const char ** | filep, | ||
int * | linep | ||
) |
Definition at line 2165 of file subr_witness.c.
References find_instance(), lock_instance::li_file, lock_instance::li_line, panic(), and panicstr.
|
static |
Definition at line 2302 of file subr_witness.c.
References find_instance(), flag, lock_instance::li_flags, panic(), and panicstr.
Referenced by witness_norelease(), and witness_releaseok().
void witness_thread_exit | ( | struct thread * | td | ) |
Definition at line 1607 of file subr_witness.c.
References lock_list_entry::ll_children, lock_list_entry::ll_count, lock_list_entry::ll_next, panic(), panicstr, printf(), witness_list_lock(), and witness_lock_list_free().
Referenced by thread_exit().
void witness_unlock | ( | struct lock_object * | lock, |
int | flags, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 1500 of file subr_witness.c.
References fixup_filename(), 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, panic(), panicstr, printf(), and witness_lock_list_free().
void witness_upgrade | ( | struct lock_object * | lock, |
int | flags, | ||
const char * | file, | ||
int | line | ||
) |
Definition at line 1421 of file subr_witness.c.
References find_instance(), fixup_filename(), LI_EXCLUSIVE, lock_instance::li_flags, LI_RECURSEMASK, panic(), and panicstr.
int witness_warn | ( | int | flags, |
struct lock_object * | lock, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 1638 of file subr_witness.c.
References Giant, lock_instance::li_lock, lock_list_entry::ll_children, lock_list_entry::ll_count, lock_list_entry::ll_next, panic(), panicstr, printf(), vprintf(), witness_debugger, witness_list_lock(), and witness_list_locks().
|
static |
Definition at line 470 of file subr_witness.c.
|
static |
Definition at line 447 of file subr_witness.c.
Referenced by witness_init().
|
static |
Definition at line 446 of file subr_witness.c.
Referenced by witness_init(), and witness_initialize().
|
static |
Definition at line 438 of file subr_witness.c.
|
static |
Definition at line 455 of file subr_witness.c.
|
static |
Definition at line 437 of file subr_witness.c.
|
static |
Definition at line 449 of file subr_witness.c.
|
static |
Definition at line 465 of file subr_witness.c.
Referenced by sysctl_debug_witness_badstacks().
|
static |
Definition at line 458 of file subr_witness.c.
Referenced by witness_hash_get(), witness_hash_put(), and witness_init_hash_tables().
|
static |
Definition at line 445 of file subr_witness.c.
Referenced by witness_lock_list_free(), and witness_lock_list_get().
|
static |
Definition at line 457 of file subr_witness.c.
Referenced by witness_initialize().
|
static |
Definition at line 461 of file subr_witness.c.
Referenced by witness_init_hash_tables().
|
static |
Definition at line 462 of file subr_witness.c.
Referenced by witness_init_hash_tables(), and witness_lock_order_add().
|
static |
Definition at line 463 of file subr_witness.c.
Referenced by sysctl_debug_witness_badstacks(), witness_init_hash_tables(), witness_lock_order_add(), and witness_lock_order_get().
|
static |
Definition at line 464 of file subr_witness.c.
Referenced by adopt(), sysctl_debug_witness_badstacks(), and witness_add_fullgraph().
|
static |
Definition at line 434 of file subr_witness.c.
Referenced by adopt(), enroll(), itismychild(), sysctl_debug_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_initialize(), witness_lock_list_free(), and witness_lock_list_get().
|
static |
Definition at line 466 of file subr_witness.c.
|
static |
Definition at line 456 of file subr_witness.c.
|
static |
Definition at line 442 of file subr_witness.c.
|
static |
Definition at line 449 of file subr_witness.c.
|
static |
Definition at line 441 of file subr_witness.c.
|
static |
Definition at line 449 of file subr_witness.c.
|
static |
Definition at line 467 of file subr_witness.c.
|
static |
Definition at line 711 of file subr_witness.c.
int witness_skipspin = 0 |
Definition at line 416 of file subr_witness.c.
|
static |
Definition at line 717 of file subr_witness.c.
|
static |
Definition at line 382 of file subr_witness.c.
Referenced by sysctl_debug_witness_watch().