subr_witness.c (76772) | subr_witness.c (77843) |
---|---|
1/*- 2 * Copyright (c) 1998 Berkeley Software Design, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 13 unchanged lines hidden (view full) --- 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * from BSDI $Id: mutex_witness.c,v 1.1.2.20 2000/04/27 03:10:27 cp Exp $ 29 * and BSDI $Id: synch_machdep.c,v 2.3.2.39 2000/04/27 03:10:25 cp Exp $ | 1/*- 2 * Copyright (c) 1998 Berkeley Software Design, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 13 unchanged lines hidden (view full) --- 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * from BSDI $Id: mutex_witness.c,v 1.1.2.20 2000/04/27 03:10:27 cp Exp $ 29 * and BSDI $Id: synch_machdep.c,v 2.3.2.39 2000/04/27 03:10:25 cp Exp $ |
30 * $FreeBSD: head/sys/kern/subr_witness.c 76772 2001-05-17 22:44:56Z jhb $ | 30 * $FreeBSD: head/sys/kern/subr_witness.c 77843 2001-06-06 22:17:08Z peter $ |
31 */ 32 33/* 34 * Implementation of the `witness' lock verifier. Originally implemented for 35 * mutexes in BSD/OS. Extended to handle generic lock objects and lock 36 * classes in FreeBSD. 37 */ 38 --- 100 unchanged lines hidden (view full) --- 139static struct lock_list_entry *witness_lock_list_get(void); 140static void witness_lock_list_free(struct lock_list_entry *lle); 141static void witness_display(void(*)(const char *fmt, ...)); 142static struct lock_instance *find_instance(struct lock_list_entry *lock_list, 143 struct lock_object *lock); 144 145MALLOC_DEFINE(M_WITNESS, "witness", "witness structure"); 146 | 31 */ 32 33/* 34 * Implementation of the `witness' lock verifier. Originally implemented for 35 * mutexes in BSD/OS. Extended to handle generic lock objects and lock 36 * classes in FreeBSD. 37 */ 38 --- 100 unchanged lines hidden (view full) --- 139static struct lock_list_entry *witness_lock_list_get(void); 140static void witness_lock_list_free(struct lock_list_entry *lle); 141static void witness_display(void(*)(const char *fmt, ...)); 142static struct lock_instance *find_instance(struct lock_list_entry *lock_list, 143 struct lock_object *lock); 144 145MALLOC_DEFINE(M_WITNESS, "witness", "witness structure"); 146 |
147static int witness_watch; 148TUNABLE_INT_DECL("debug.witness_watch", 1, witness_watch); | 147static int witness_watch = 1; 148TUNABLE_INT("debug.witness_watch", &witness_watch); |
149SYSCTL_INT(_debug, OID_AUTO, witness_watch, CTLFLAG_RD, &witness_watch, 0, ""); 150 151#ifdef DDB 152/* 153 * When DDB is enabled and witness_ddb is set to 1, it will cause the system to 154 * drop into kdebug() when: 155 * - a lock heirarchy violation occurs 156 * - locks are held when going to sleep. 157 */ | 149SYSCTL_INT(_debug, OID_AUTO, witness_watch, CTLFLAG_RD, &witness_watch, 0, ""); 150 151#ifdef DDB 152/* 153 * When DDB is enabled and witness_ddb is set to 1, it will cause the system to 154 * drop into kdebug() when: 155 * - a lock heirarchy violation occurs 156 * - locks are held when going to sleep. 157 */ |
158int witness_ddb; | |
159#ifdef WITNESS_DDB | 158#ifdef WITNESS_DDB |
160TUNABLE_INT_DECL("debug.witness_ddb", 1, witness_ddb); | 159int witness_ddb = 1; |
161#else | 160#else |
162TUNABLE_INT_DECL("debug.witness_ddb", 0, witness_ddb); | 161int witness_ddb = 0; |
163#endif | 162#endif |
163TUNABLE_INT("debug.witness_ddb", &witness_ddb); |
|
164SYSCTL_INT(_debug, OID_AUTO, witness_ddb, CTLFLAG_RW, &witness_ddb, 0, ""); 165#endif /* DDB */ 166 | 164SYSCTL_INT(_debug, OID_AUTO, witness_ddb, CTLFLAG_RW, &witness_ddb, 0, ""); 165#endif /* DDB */ 166 |
167int witness_skipspin; | |
168#ifdef WITNESS_SKIPSPIN | 167#ifdef WITNESS_SKIPSPIN |
169TUNABLE_INT_DECL("debug.witness_skipspin", 1, witness_skipspin); | 168int witness_skipspin = 1; |
170#else | 169#else |
171TUNABLE_INT_DECL("debug.witness_skipspin", 0, witness_skipspin); | 170int witness_skipspin = 0; |
172#endif | 171#endif |
172TUNABLE_INT("debug.witness_skipspin", &witness_skipspin); |
|
173SYSCTL_INT(_debug, OID_AUTO, witness_skipspin, CTLFLAG_RD, &witness_skipspin, 0, 174 ""); 175 176static struct mtx w_mtx; 177static struct witness_list w_free = STAILQ_HEAD_INITIALIZER(w_free); 178static struct witness_list w_all = STAILQ_HEAD_INITIALIZER(w_all); 179static struct witness_list w_spin = STAILQ_HEAD_INITIALIZER(w_spin); 180static struct witness_list w_sleep = STAILQ_HEAD_INITIALIZER(w_sleep); --- 1159 unchanged lines hidden --- | 173SYSCTL_INT(_debug, OID_AUTO, witness_skipspin, CTLFLAG_RD, &witness_skipspin, 0, 174 ""); 175 176static struct mtx w_mtx; 177static struct witness_list w_free = STAILQ_HEAD_INITIALIZER(w_free); 178static struct witness_list w_all = STAILQ_HEAD_INITIALIZER(w_all); 179static struct witness_list w_spin = STAILQ_HEAD_INITIALIZER(w_spin); 180static struct witness_list w_sleep = STAILQ_HEAD_INITIALIZER(w_sleep); --- 1159 unchanged lines hidden --- |