subr_witness.c (65650) | subr_witness.c (65651) |
---|---|
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. --- 12 unchanged lines hidden (view full) --- 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 $ | 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. --- 12 unchanged lines hidden (view full) --- 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * $FreeBSD: head/sys/kern/subr_witness.c 65650 2000-09-09 22:43:22Z jasone $ | 29 * $FreeBSD: head/sys/kern/subr_witness.c 65651 2000-09-09 23:18:48Z jasone $ |
30 */ 31 32/* 33 * Main Entry: witness 34 * Pronunciation: 'wit-n&s 35 * Function: noun 36 * Etymology: Middle English witnesse, from Old English witnes knowledge, 37 * testimony, witness, from 2wit --- 198 unchanged lines hidden (view full) --- 236 int go_into_kdebug = 0; 237#endif /* KDEBUG */ 238 239 w = m->mtx_witness; 240 p = CURPROC; 241 242 if (flags & MTX_SPIN) { 243 if (!w->w_spin) | 30 */ 31 32/* 33 * Main Entry: witness 34 * Pronunciation: 'wit-n&s 35 * Function: noun 36 * Etymology: Middle English witnesse, from Old English witnes knowledge, 37 * testimony, witness, from 2wit --- 198 unchanged lines hidden (view full) --- 236 int go_into_kdebug = 0; 237#endif /* KDEBUG */ 238 239 w = m->mtx_witness; 240 p = CURPROC; 241 242 if (flags & MTX_SPIN) { 243 if (!w->w_spin) |
244 panic("mutex_enter: MTX_SPIN on MTX_DEF mutex %s @ %s:%d", 245 m->mtx_description, file, line); | 244 panic("mutex_enter: MTX_SPIN on MTX_DEF mutex %s @" 245 " %s:%d", m->mtx_description, file, line); |
246 if (m->mtx_recurse != 0) 247 return; 248 mtx_enter(&w_mtx, MTX_SPIN); 249 i = witness_spin_check; 250 if (i != 0 && w->w_level < i) { 251 mtx_exit(&w_mtx, MTX_SPIN); | 246 if (m->mtx_recurse != 0) 247 return; 248 mtx_enter(&w_mtx, MTX_SPIN); 249 i = witness_spin_check; 250 if (i != 0 && w->w_level < i) { 251 mtx_exit(&w_mtx, MTX_SPIN); |
252 panic("mutex_enter(%s:%x, MTX_SPIN) out of order @ %s:%d" 253 " already holding %s:%x", | 252 panic("mutex_enter(%s:%x, MTX_SPIN) out of order @" 253 " %s:%d already holding %s:%x", |
254 m->mtx_description, w->w_level, file, line, 255 spin_order_list[ffs(i)-1], i); 256 } 257 PCPU_SET(witness_spin_check, i | w->w_level); 258 mtx_exit(&w_mtx, MTX_SPIN); 259 return; 260 } 261 if (w->w_spin) --- 11 unchanged lines hidden (view full) --- 273 panic("blockable mtx_enter() of %s when not legal @ %s:%d", 274 m->mtx_description, file, line); 275 /* 276 * Is this the first mutex acquired 277 */ 278 if ((m1 = LIST_FIRST(&p->p_heldmtx)) == NULL) 279 goto out; 280 | 254 m->mtx_description, w->w_level, file, line, 255 spin_order_list[ffs(i)-1], i); 256 } 257 PCPU_SET(witness_spin_check, i | w->w_level); 258 mtx_exit(&w_mtx, MTX_SPIN); 259 return; 260 } 261 if (w->w_spin) --- 11 unchanged lines hidden (view full) --- 273 panic("blockable mtx_enter() of %s when not legal @ %s:%d", 274 m->mtx_description, file, line); 275 /* 276 * Is this the first mutex acquired 277 */ 278 if ((m1 = LIST_FIRST(&p->p_heldmtx)) == NULL) 279 goto out; 280 |
281 | |
282 if ((w1 = m1->mtx_witness) == w) { 283 if (w->w_same_squawked || dup_ok(w)) 284 goto out; 285 w->w_same_squawked = 1; 286 printf("acquring duplicate lock of same type: \"%s\"\n", 287 m->mtx_description); 288 printf(" 1st @ %s:%d\n", w->w_file, w->w_line); 289 printf(" 2nd @ %s:%d\n", file, line); --- 74 unchanged lines hidden (view full) --- 364witness_exit(mtx_t *m, int flags, const char *file, int line) 365{ 366 witness_t *w; 367 368 w = m->mtx_witness; 369 370 if (flags & MTX_SPIN) { 371 if (!w->w_spin) | 281 if ((w1 = m1->mtx_witness) == w) { 282 if (w->w_same_squawked || dup_ok(w)) 283 goto out; 284 w->w_same_squawked = 1; 285 printf("acquring duplicate lock of same type: \"%s\"\n", 286 m->mtx_description); 287 printf(" 1st @ %s:%d\n", w->w_file, w->w_line); 288 printf(" 2nd @ %s:%d\n", file, line); --- 74 unchanged lines hidden (view full) --- 363witness_exit(mtx_t *m, int flags, const char *file, int line) 364{ 365 witness_t *w; 366 367 w = m->mtx_witness; 368 369 if (flags & MTX_SPIN) { 370 if (!w->w_spin) |
372 panic("mutex_exit: MTX_SPIN on MTX_DEF mutex %s @ %s:%d", 373 m->mtx_description, file, line); | 371 panic("mutex_exit: MTX_SPIN on MTX_DEF mutex %s @" 372 " %s:%d", m->mtx_description, file, line); |
374 if (m->mtx_recurse != 0) 375 return; 376 mtx_enter(&w_mtx, MTX_SPIN); 377 PCPU_SET(witness_spin_check, witness_spin_check & ~w->w_level); 378 mtx_exit(&w_mtx, MTX_SPIN); 379 return; 380 } 381 if (w->w_spin) --- 11 unchanged lines hidden (view full) --- 393} 394 395void 396witness_try_enter(mtx_t *m, int flags, const char *file, int line) 397{ 398 struct proc *p; 399 witness_t *w = m->mtx_witness; 400 | 373 if (m->mtx_recurse != 0) 374 return; 375 mtx_enter(&w_mtx, MTX_SPIN); 376 PCPU_SET(witness_spin_check, witness_spin_check & ~w->w_level); 377 mtx_exit(&w_mtx, MTX_SPIN); 378 return; 379 } 380 if (w->w_spin) --- 11 unchanged lines hidden (view full) --- 392} 393 394void 395witness_try_enter(mtx_t *m, int flags, const char *file, int line) 396{ 397 struct proc *p; 398 witness_t *w = m->mtx_witness; 399 |
401 | |
402 if (flags & MTX_SPIN) { 403 if (!w->w_spin) 404 panic("mutex_try_enter: " 405 "MTX_SPIN on MTX_DEF mutex %s @ %s:%d", 406 m->mtx_description, file, line); 407 if (m->mtx_recurse != 0) 408 return; 409 mtx_enter(&w_mtx, MTX_SPIN); --- 390 unchanged lines hidden --- | 400 if (flags & MTX_SPIN) { 401 if (!w->w_spin) 402 panic("mutex_try_enter: " 403 "MTX_SPIN on MTX_DEF mutex %s @ %s:%d", 404 m->mtx_description, file, line); 405 if (m->mtx_recurse != 0) 406 return; 407 mtx_enter(&w_mtx, MTX_SPIN); --- 390 unchanged lines hidden --- |