subr_witness.c (75362) | subr_witness.c (75364) |
---|---|
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 75362 2001-04-09 22:34:05Z jhb $ | 30 * $FreeBSD: head/sys/kern/subr_witness.c 75364 2001-04-10 00:56:19Z bp $ |
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 --- 734 unchanged lines hidden (view full) --- 773 w->w_class->lc_name); 774 return (w); 775 } 776 } 777 /* 778 * This isn't quite right, as witness_cold is still 0 while we 779 * enroll all the locks initialized before witness_initialize(). 780 */ | 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 --- 734 unchanged lines hidden (view full) --- 773 w->w_class->lc_name); 774 return (w); 775 } 776 } 777 /* 778 * This isn't quite right, as witness_cold is still 0 while we 779 * enroll all the locks initialized before witness_initialize(). 780 */ |
781 if ((lock_class->lc_flags & LC_SPINLOCK) && !witness_cold) | 781 if ((lock_class->lc_flags & LC_SPINLOCK) && !witness_cold) { 782 mtx_unlock_spin(&w_mtx); |
782 panic("spin lock %s not in order list", description); | 783 panic("spin lock %s not in order list", description); |
784 } |
|
783 if ((w = witness_get()) == NULL) 784 return (NULL); 785 w->w_name = description; 786 w->w_class = lock_class; 787 w->w_refcount = 1; 788 STAILQ_INSERT_HEAD(&w_all, w, w_list); 789 if (lock_class->lc_flags & LC_SPINLOCK) 790 STAILQ_INSERT_HEAD(&w_spin, w, w_typelist); 791 else if (lock_class->lc_flags & LC_SLEEPLOCK) 792 STAILQ_INSERT_HEAD(&w_sleep, w, w_typelist); | 785 if ((w = witness_get()) == NULL) 786 return (NULL); 787 w->w_name = description; 788 w->w_class = lock_class; 789 w->w_refcount = 1; 790 STAILQ_INSERT_HEAD(&w_all, w, w_list); 791 if (lock_class->lc_flags & LC_SPINLOCK) 792 STAILQ_INSERT_HEAD(&w_spin, w, w_typelist); 793 else if (lock_class->lc_flags & LC_SLEEPLOCK) 794 STAILQ_INSERT_HEAD(&w_sleep, w, w_typelist); |
793 else | 795 else { 796 mtx_unlock_spin(&w_mtx); |
794 panic("lock class %s is not sleep or spin", 795 lock_class->lc_name); | 797 panic("lock class %s is not sleep or spin", 798 lock_class->lc_name); |
799 } |
|
796 mtx_unlock_spin(&w_mtx); 797 798 return (w); 799} 800 801static int 802itismychild(struct witness *parent, struct witness *child) 803{ --- 409 unchanged lines hidden --- | 800 mtx_unlock_spin(&w_mtx); 801 802 return (w); 803} 804 805static int 806itismychild(struct witness *parent, struct witness *child) 807{ --- 409 unchanged lines hidden --- |