Date: Wed, 21 Mar 2007 21:27:12 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 116296 for review Message-ID: <200703212127.l2LLRCHr025409@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=116296 Change 116296 by jhb@jhb_mutex on 2007/03/21 21:26:23 IFC @116295. Affected files ... .. //depot/projects/smpng/sys/kern/kern_condvar.c#46 integrate .. //depot/projects/smpng/sys/kern/kern_exit.c#121 integrate .. //depot/projects/smpng/sys/kern/kern_kse.c#37 integrate .. //depot/projects/smpng/sys/kern/kern_lock.c#61 integrate .. //depot/projects/smpng/sys/kern/kern_mutex.c#144 integrate .. //depot/projects/smpng/sys/kern/kern_rwlock.c#13 integrate .. //depot/projects/smpng/sys/kern/kern_sig.c#133 integrate .. //depot/projects/smpng/sys/kern/kern_sx.c#44 integrate .. //depot/projects/smpng/sys/kern/kern_synch.c#115 integrate .. //depot/projects/smpng/sys/kern/subr_witness.c#160 integrate .. //depot/projects/smpng/sys/sys/_mutex.h#17 integrate .. //depot/projects/smpng/sys/sys/_rwlock.h#3 integrate .. //depot/projects/smpng/sys/sys/lock.h#44 integrate .. //depot/projects/smpng/sys/sys/mutex.h#71 integrate .. //depot/projects/smpng/sys/sys/proc.h#179 integrate .. //depot/projects/smpng/sys/sys/rwlock.h#8 integrate .. //depot/projects/smpng/sys/sys/sx.h#24 integrate .. //depot/projects/smpng/sys/sys/systm.h#82 integrate Differences ... ==== //depot/projects/smpng/sys/kern/kern_condvar.c#46 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_condvar.c,v 1.58 2007/03/21 20:46:26 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_condvar.c,v 1.59 2007/03/21 21:20:50 jhb Exp $"); #include "opt_ktrace.h" @@ -104,9 +104,9 @@ ktrcsw(1, 0); #endif CV_ASSERT(cvp, mp, td); - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &mp->mtx_object, + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &mp->lock_object, "Waiting on \"%s\"", cvp->cv_description); - WITNESS_SAVE(&mp->mtx_object, mp); + WITNESS_SAVE(&mp->lock_object, mp); if (cold || panicstr) { /* @@ -124,7 +124,7 @@ DROP_GIANT(); mtx_unlock(mp); - sleepq_add(cvp, &mp->mtx_object, cvp->cv_description, SLEEPQ_CONDVAR, + sleepq_add(cvp, &mp->lock_object, cvp->cv_description, SLEEPQ_CONDVAR, 0); sleepq_wait(cvp); @@ -134,7 +134,7 @@ #endif PICKUP_GIANT(); mtx_lock(mp); - WITNESS_RESTORE(&mp->mtx_object, mp); + WITNESS_RESTORE(&mp->lock_object, mp); } /* @@ -152,7 +152,7 @@ ktrcsw(1, 0); #endif CV_ASSERT(cvp, mp, td); - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &mp->mtx_object, + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &mp->lock_object, "Waiting on \"%s\"", cvp->cv_description); if (cold || panicstr) { @@ -172,7 +172,7 @@ DROP_GIANT(); mtx_unlock(mp); - sleepq_add(cvp, &mp->mtx_object, cvp->cv_description, SLEEPQ_CONDVAR, + sleepq_add(cvp, &mp->lock_object, cvp->cv_description, SLEEPQ_CONDVAR, 0); sleepq_wait(cvp); @@ -204,9 +204,9 @@ ktrcsw(1, 0); #endif CV_ASSERT(cvp, mp, td); - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &mp->mtx_object, + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &mp->lock_object, "Waiting on \"%s\"", cvp->cv_description); - WITNESS_SAVE(&mp->mtx_object, mp); + WITNESS_SAVE(&mp->lock_object, mp); if (cold || panicstr) { /* @@ -224,7 +224,7 @@ DROP_GIANT(); mtx_unlock(mp); - sleepq_add(cvp, &mp->mtx_object, cvp->cv_description, SLEEPQ_CONDVAR | + sleepq_add(cvp, &mp->lock_object, cvp->cv_description, SLEEPQ_CONDVAR | SLEEPQ_INTERRUPTIBLE, 0); rval = sleepq_wait_sig(cvp); @@ -234,7 +234,7 @@ #endif PICKUP_GIANT(); mtx_lock(mp); - WITNESS_RESTORE(&mp->mtx_object, mp); + WITNESS_RESTORE(&mp->lock_object, mp); return (rval); } @@ -258,9 +258,9 @@ ktrcsw(1, 0); #endif CV_ASSERT(cvp, mp, td); - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &mp->mtx_object, + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &mp->lock_object, "Waiting on \"%s\"", cvp->cv_description); - WITNESS_SAVE(&mp->mtx_object, mp); + WITNESS_SAVE(&mp->lock_object, mp); if (cold || panicstr) { /* @@ -278,7 +278,7 @@ DROP_GIANT(); mtx_unlock(mp); - sleepq_add(cvp, &mp->mtx_object, cvp->cv_description, SLEEPQ_CONDVAR, + sleepq_add(cvp, &mp->lock_object, cvp->cv_description, SLEEPQ_CONDVAR, 0); sleepq_set_timeout(cvp, timo); rval = sleepq_timedwait(cvp); @@ -289,7 +289,7 @@ #endif PICKUP_GIANT(); mtx_lock(mp); - WITNESS_RESTORE(&mp->mtx_object, mp); + WITNESS_RESTORE(&mp->lock_object, mp); return (rval); } @@ -316,9 +316,9 @@ ktrcsw(1, 0); #endif CV_ASSERT(cvp, mp, td); - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &mp->mtx_object, + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &mp->lock_object, "Waiting on \"%s\"", cvp->cv_description); - WITNESS_SAVE(&mp->mtx_object, mp); + WITNESS_SAVE(&mp->lock_object, mp); if (cold || panicstr) { /* @@ -336,7 +336,7 @@ DROP_GIANT(); mtx_unlock(mp); - sleepq_add(cvp, &mp->mtx_object, cvp->cv_description, SLEEPQ_CONDVAR | + sleepq_add(cvp, &mp->lock_object, cvp->cv_description, SLEEPQ_CONDVAR | SLEEPQ_INTERRUPTIBLE, 0); sleepq_set_timeout(cvp, timo); rval = sleepq_timedwait_sig(cvp); @@ -347,7 +347,7 @@ #endif PICKUP_GIANT(); mtx_lock(mp); - WITNESS_RESTORE(&mp->mtx_object, mp); + WITNESS_RESTORE(&mp->lock_object, mp); return (rval); } ==== //depot/projects/smpng/sys/kern/kern_exit.c#121 (text+ko) ==== @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_exit.c,v 1.296 2007/03/05 13:10:57 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_exit.c,v 1.297 2007/03/21 21:20:50 jhb Exp $"); #include "opt_compat.h" #include "opt_ktrace.h" @@ -495,7 +495,7 @@ */ cpu_exit(td); - WITNESS_WARN(WARN_PANIC, &proctree_lock.sx_object, + WITNESS_WARN(WARN_PANIC, &proctree_lock.lock_object, "process (pid %d) exiting", p->p_pid); PROC_LOCK(p); ==== //depot/projects/smpng/sys/kern/kern_kse.c#37 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_kse.c,v 1.228 2007/03/07 20:17:41 julian Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_kse.c,v 1.229 2007/03/21 21:20:50 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1253,7 +1253,7 @@ PROC_LOCK(p); if (p->p_upsleeps) wakeup(&p->p_completed); - WITNESS_WARN(WARN_PANIC, &p->p_mtx.mtx_object, + WITNESS_WARN(WARN_PANIC, &p->p_mtx.lock_object, "thread exiting in userret"); sigqueue_flush(&td->td_sigqueue); mtx_lock_spin(&sched_lock); ==== //depot/projects/smpng/sys/kern/kern_lock.c#61 (text+ko) ==== @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_lock.c,v 1.107 2007/03/21 19:28:20 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_lock.c,v 1.108 2007/03/21 21:20:50 jhb Exp $"); #include "opt_ddb.h" #include "opt_global.h" @@ -217,7 +217,7 @@ if ((flags & (LK_NOWAIT|LK_RELEASE)) == 0) WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, - &lkp->lk_interlock->mtx_object, + &lkp->lk_interlock->lock_object, "Acquiring lockmgr lock \"%s\"", lkp->lk_wmesg); if (panicstr != NULL) { ==== //depot/projects/smpng/sys/kern/kern_mutex.c#144 (text+ko) ==== @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_mutex.c,v 1.185 2007/03/09 16:27:11 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_mutex.c,v 1.186 2007/03/21 21:20:50 jhb Exp $"); #include "opt_adaptive_mutexes.h" #include "opt_ddb.h" @@ -181,16 +181,16 @@ MPASS(curthread != NULL); KASSERT(m->mtx_lock != MTX_DESTROYED, ("mtx_lock() of destroyed mutex @ %s:%d", file, line)); - KASSERT(LOCK_CLASS(&m->mtx_object) == &lock_class_mtx_sleep, - ("mtx_lock() of spin mutex %s @ %s:%d", m->mtx_object.lo_name, + KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_sleep, + ("mtx_lock() of spin mutex %s @ %s:%d", m->lock_object.lo_name, file, line)); - WITNESS_CHECKORDER(&m->mtx_object, opts | LOP_NEWORDER | LOP_EXCLUSIVE, + WITNESS_CHECKORDER(&m->lock_object, opts | LOP_NEWORDER | LOP_EXCLUSIVE, file, line); _get_sleep_lock(m, curthread, opts, file, line); - LOCK_LOG_LOCK("LOCK", &m->mtx_object, opts, m->mtx_recurse, file, + LOCK_LOG_LOCK("LOCK", &m->lock_object, opts, m->mtx_recurse, file, line); - WITNESS_LOCK(&m->mtx_object, opts | LOP_EXCLUSIVE, file, line); + WITNESS_LOCK(&m->lock_object, opts | LOP_EXCLUSIVE, file, line); curthread->td_locks++; } @@ -200,16 +200,16 @@ MPASS(curthread != NULL); KASSERT(m->mtx_lock != MTX_DESTROYED, ("mtx_unlock() of destroyed mutex @ %s:%d", file, line)); - KASSERT(LOCK_CLASS(&m->mtx_object) == &lock_class_mtx_sleep, - ("mtx_unlock() of spin mutex %s @ %s:%d", m->mtx_object.lo_name, + KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_sleep, + ("mtx_unlock() of spin mutex %s @ %s:%d", m->lock_object.lo_name, file, line)); curthread->td_locks--; - WITNESS_UNLOCK(&m->mtx_object, opts | LOP_EXCLUSIVE, file, line); - LOCK_LOG_LOCK("UNLOCK", &m->mtx_object, opts, m->mtx_recurse, file, + WITNESS_UNLOCK(&m->lock_object, opts | LOP_EXCLUSIVE, file, line); + LOCK_LOG_LOCK("UNLOCK", &m->lock_object, opts, m->mtx_recurse, file, line); mtx_assert(m, MA_OWNED); - lock_profile_release_lock(&m->mtx_object); + lock_profile_release_lock(&m->lock_object); _rel_sleep_lock(m, curthread, opts, file, line); } @@ -220,15 +220,15 @@ MPASS(curthread != NULL); KASSERT(m->mtx_lock != MTX_DESTROYED, ("mtx_lock_spin() of destroyed mutex @ %s:%d", file, line)); - KASSERT(LOCK_CLASS(&m->mtx_object) == &lock_class_mtx_spin, + KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_spin, ("mtx_lock_spin() of sleep mutex %s @ %s:%d", - m->mtx_object.lo_name, file, line)); - WITNESS_CHECKORDER(&m->mtx_object, opts | LOP_NEWORDER | LOP_EXCLUSIVE, + m->lock_object.lo_name, file, line)); + WITNESS_CHECKORDER(&m->lock_object, opts | LOP_NEWORDER | LOP_EXCLUSIVE, file, line); _get_spin_lock(m, curthread, opts, file, line); - LOCK_LOG_LOCK("LOCK", &m->mtx_object, opts, m->mtx_recurse, file, + LOCK_LOG_LOCK("LOCK", &m->lock_object, opts, m->mtx_recurse, file, line); - WITNESS_LOCK(&m->mtx_object, opts | LOP_EXCLUSIVE, file, line); + WITNESS_LOCK(&m->lock_object, opts | LOP_EXCLUSIVE, file, line); } void @@ -238,15 +238,15 @@ MPASS(curthread != NULL); KASSERT(m->mtx_lock != MTX_DESTROYED, ("mtx_unlock_spin() of destroyed mutex @ %s:%d", file, line)); - KASSERT(LOCK_CLASS(&m->mtx_object) == &lock_class_mtx_spin, + KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_spin, ("mtx_unlock_spin() of sleep mutex %s @ %s:%d", - m->mtx_object.lo_name, file, line)); - WITNESS_UNLOCK(&m->mtx_object, opts | LOP_EXCLUSIVE, file, line); - LOCK_LOG_LOCK("UNLOCK", &m->mtx_object, opts, m->mtx_recurse, file, + m->lock_object.lo_name, file, line)); + WITNESS_UNLOCK(&m->lock_object, opts | LOP_EXCLUSIVE, file, line); + LOCK_LOG_LOCK("UNLOCK", &m->lock_object, opts, m->mtx_recurse, file, line); mtx_assert(m, MA_OWNED); - lock_profile_release_lock(&m->mtx_object); + lock_profile_release_lock(&m->lock_object); _rel_spin_lock(m); } @@ -264,24 +264,24 @@ MPASS(curthread != NULL); KASSERT(m->mtx_lock != MTX_DESTROYED, ("mtx_trylock() of destroyed mutex @ %s:%d", file, line)); - KASSERT(LOCK_CLASS(&m->mtx_object) == &lock_class_mtx_sleep, - ("mtx_trylock() of spin mutex %s @ %s:%d", m->mtx_object.lo_name, + KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_sleep, + ("mtx_trylock() of spin mutex %s @ %s:%d", m->lock_object.lo_name, file, line)); - if (mtx_owned(m) && (m->mtx_object.lo_flags & LO_RECURSABLE) != 0) { + if (mtx_owned(m) && (m->lock_object.lo_flags & LO_RECURSABLE) != 0) { m->mtx_recurse++; atomic_set_ptr(&m->mtx_lock, MTX_RECURSED); rval = 1; } else rval = _obtain_lock(m, (uintptr_t)curthread); - LOCK_LOG_TRY("LOCK", &m->mtx_object, opts, rval, file, line); + LOCK_LOG_TRY("LOCK", &m->lock_object, opts, rval, file, line); if (rval) { - WITNESS_LOCK(&m->mtx_object, opts | LOP_EXCLUSIVE | LOP_TRYLOCK, + WITNESS_LOCK(&m->lock_object, opts | LOP_EXCLUSIVE | LOP_TRYLOCK, file, line); curthread->td_locks++; if (m->mtx_recurse == 0) - lock_profile_obtain_lock_success(&m->mtx_object, contested, + lock_profile_obtain_lock_success(&m->lock_object, contested, waittime, file, line); } @@ -308,12 +308,12 @@ uintptr_t v; if (mtx_owned(m)) { - KASSERT((m->mtx_object.lo_flags & LO_RECURSABLE) != 0, + KASSERT((m->lock_object.lo_flags & LO_RECURSABLE) != 0, ("_mtx_lock_sleep: recursed on non-recursive mutex %s @ %s:%d\n", - m->mtx_object.lo_name, file, line)); + m->lock_object.lo_name, file, line)); m->mtx_recurse++; atomic_set_ptr(&m->mtx_lock, MTX_RECURSED); - if (LOCK_LOG_TEST(&m->mtx_object, opts)) + if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR1(KTR_LOCK, "_mtx_lock_sleep: %p recursing", m); return; } @@ -327,13 +327,13 @@ if (panicstr != NULL && curthread->td_flags & TDF_INPANIC) return; - if (LOCK_LOG_TEST(&m->mtx_object, opts)) + if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR4(KTR_LOCK, "_mtx_lock_sleep: %s contested (lock=%p) at %s:%d", - m->mtx_object.lo_name, (void *)m->mtx_lock, file, line); + m->lock_object.lo_name, (void *)m->mtx_lock, file, line); while (!_obtain_lock(m, tid)) { - turnstile_lock(&m->mtx_object); + turnstile_lock(&m->lock_object); v = m->mtx_lock; /* @@ -341,7 +341,7 @@ * the turnstile chain lock. */ if (v == MTX_UNOWNED) { - turnstile_release(&m->mtx_object); + turnstile_release(&m->lock_object); cpu_spinwait(); continue; } @@ -357,7 +357,7 @@ */ if (v == MTX_CONTESTED) { m->mtx_lock = tid | MTX_CONTESTED; - turnstile_claim(&m->mtx_object); + turnstile_claim(&m->lock_object); break; } #endif @@ -369,7 +369,7 @@ */ if ((v & MTX_CONTESTED) == 0 && !atomic_cmpset_ptr(&m->mtx_lock, v, v | MTX_CONTESTED)) { - turnstile_release(&m->mtx_object); + turnstile_release(&m->lock_object); cpu_spinwait(); continue; } @@ -386,7 +386,7 @@ if (m != &Giant && TD_IS_RUNNING(owner)) #endif { - turnstile_release(&m->mtx_object); + turnstile_release(&m->lock_object); while (mtx_owner(m) == owner && TD_IS_RUNNING(owner)) { cpu_spinwait(); } @@ -403,9 +403,9 @@ if (!cont_logged) { CTR6(KTR_CONTENTION, "contention: %p at %s:%d wants %s, taken by %s:%d", - (void *)tid, file, line, m->mtx_object.lo_name, - WITNESS_FILE(&m->mtx_object), - WITNESS_LINE(&m->mtx_object)); + (void *)tid, file, line, m->lock_object.lo_name, + WITNESS_FILE(&m->lock_object), + WITNESS_LINE(&m->lock_object)); cont_logged = 1; } #endif @@ -413,14 +413,14 @@ /* * Block on the turnstile. */ - turnstile_wait(&m->mtx_object, mtx_owner(m), + turnstile_wait(&m->lock_object, mtx_owner(m), TS_EXCLUSIVE_QUEUE); } #ifdef KTR if (cont_logged) { CTR4(KTR_CONTENTION, "contention end: %s acquired by %p at %s:%d", - m->mtx_object.lo_name, (void *)tid, file, line); + m->lock_object.lo_name, (void *)tid, file, line); } #endif return; @@ -440,7 +440,7 @@ int i = 0; struct thread *td; - if (LOCK_LOG_TEST(&m->mtx_object, opts)) + if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR1(KTR_LOCK, "_mtx_lock_spin: %p spinning", m); while (!_obtain_lock(m, tid)) { @@ -462,9 +462,9 @@ continue; printf( "spin lock %p (%s) held by %p (tid %d) too long\n", - m, m->mtx_object.lo_name, td, td->td_tid); + m, m->lock_object.lo_name, td, td->td_tid); #ifdef WITNESS - witness_display_spinlock(&m->mtx_object, td); + witness_display_spinlock(&m->lock_object, td); #endif panic("spin lock held too long"); } @@ -473,7 +473,7 @@ spinlock_enter(); } - if (LOCK_LOG_TEST(&m->mtx_object, opts)) + if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR1(KTR_LOCK, "_mtx_lock_spin: %p spin done", m); return; @@ -497,7 +497,7 @@ if (mtx_recursed(m)) { if (--(m->mtx_recurse) == 0) atomic_clear_ptr(&m->mtx_lock, MTX_RECURSED); - if (LOCK_LOG_TEST(&m->mtx_object, opts)) + if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p unrecurse", m); return; } @@ -511,17 +511,17 @@ if (panicstr != NULL && curthread->td_flags & TDF_INPANIC) return; - turnstile_lock(&m->mtx_object); - ts = turnstile_lookup(&m->mtx_object); - if (LOCK_LOG_TEST(&m->mtx_object, opts)) + turnstile_lock(&m->lock_object); + ts = turnstile_lookup(&m->lock_object); + if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p contested", m); #if defined(SMP) && !defined(NO_ADAPTIVE_MUTEXES) if (ts == NULL) { _release_lock_quick(m); - if (LOCK_LOG_TEST(&m->mtx_object, opts)) + if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p no sleepers", m); - turnstile_release(&m->mtx_object); + turnstile_release(&m->lock_object); return; } #else @@ -537,11 +537,11 @@ #else if (turnstile_signal(ts, TS_EXCLUSIVE_QUEUE)) { _release_lock_quick(m); - if (LOCK_LOG_TEST(&m->mtx_object, opts)) + if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p not held", m); } else { m->mtx_lock = MTX_CONTESTED; - if (LOCK_LOG_TEST(&m->mtx_object, opts)) + if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p still contested", m); } @@ -566,7 +566,7 @@ struct ithd *it = td->td_ithd; if (it->it_interrupted) { - if (LOCK_LOG_TEST(&m->mtx_object, opts)) + if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR2(KTR_LOCK, "_mtx_unlock_sleep: %p interrupted %p", it, it->it_interrupted); @@ -574,13 +574,13 @@ } } #endif - if (LOCK_LOG_TEST(&m->mtx_object, opts)) + if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR2(KTR_LOCK, "_mtx_unlock_sleep: %p switching out lock=%p", m, (void *)m->mtx_lock); mi_switch(SW_INVOL, NULL); - if (LOCK_LOG_TEST(&m->mtx_object, opts)) + if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR2(KTR_LOCK, "_mtx_unlock_sleep: %p resuming lock=%p", m, (void *)m->mtx_lock); } @@ -611,20 +611,20 @@ case MA_OWNED | MA_NOTRECURSED: if (!mtx_owned(m)) panic("mutex %s not owned at %s:%d", - m->mtx_object.lo_name, file, line); + m->lock_object.lo_name, file, line); if (mtx_recursed(m)) { if ((what & MA_NOTRECURSED) != 0) panic("mutex %s recursed at %s:%d", - m->mtx_object.lo_name, file, line); + m->lock_object.lo_name, file, line); } else if ((what & MA_RECURSED) != 0) { panic("mutex %s unrecursed at %s:%d", - m->mtx_object.lo_name, file, line); + m->lock_object.lo_name, file, line); } break; case MA_NOTOWNED: if (mtx_owned(m)) panic("mutex %s owned at %s:%d", - m->mtx_object.lo_name, file, line); + m->lock_object.lo_name, file, line); break; default: panic("unknown mtx_assert at %s:%d", file, line); @@ -715,8 +715,8 @@ m->mtx_lock = MTX_UNOWNED; m->mtx_recurse = 0; - lock_profile_object_init(&m->mtx_object, class, name); - lock_init(&m->mtx_object, class, name, type, flags); + lock_profile_object_init(&m->lock_object, class, name); + lock_init(&m->lock_object, class, name, type, flags); } /* @@ -735,19 +735,19 @@ MPASS((m->mtx_lock & (MTX_RECURSED|MTX_CONTESTED)) == 0); /* Perform the non-mtx related part of mtx_unlock_spin(). */ - if (LOCK_CLASS(&m->mtx_object) == &lock_class_mtx_spin) + if (LOCK_CLASS(&m->lock_object) == &lock_class_mtx_spin) spinlock_exit(); else curthread->td_locks--; /* Tell witness this isn't locked to make it happy. */ - WITNESS_UNLOCK(&m->mtx_object, LOP_EXCLUSIVE, __FILE__, + WITNESS_UNLOCK(&m->lock_object, LOP_EXCLUSIVE, __FILE__, __LINE__); } m->mtx_lock = MTX_DESTROYED; - lock_profile_object_destroy(&m->mtx_object); - lock_destroy(&m->mtx_object); + lock_profile_object_destroy(&m->lock_object); + lock_destroy(&m->lock_object); } /* @@ -788,9 +788,9 @@ db_printf("SPIN"); else db_printf("DEF"); - if (m->mtx_object.lo_flags & LO_RECURSABLE) + if (m->lock_object.lo_flags & LO_RECURSABLE) db_printf(", RECURSE"); - if (m->mtx_object.lo_flags & LO_DUPOK) + if (m->lock_object.lo_flags & LO_DUPOK) db_printf(", DUPOK"); db_printf("}\n"); db_printf(" state: {"); ==== //depot/projects/smpng/sys/kern/kern_rwlock.c#13 (text+ko) ==== @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_rwlock.c,v 1.20 2007/03/13 16:51:27 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_rwlock.c,v 1.21 2007/03/21 21:20:50 jhb Exp $"); #include "opt_ddb.h" @@ -118,8 +118,8 @@ rw->rw_lock = RW_UNLOCKED; - lock_profile_object_init(&rw->rw_object, &lock_class_rw, name); - lock_init(&rw->rw_object, &lock_class_rw, name, NULL, LO_WITNESS | + lock_profile_object_init(&rw->lock_object, &lock_class_rw, name); + lock_init(&rw->lock_object, &lock_class_rw, name, NULL, LO_WITNESS | LO_RECURSABLE | LO_UPGRADABLE); } @@ -128,8 +128,8 @@ { KASSERT(rw->rw_lock == RW_UNLOCKED, ("rw lock not unlocked")); - lock_profile_object_destroy(&rw->rw_object); - lock_destroy(&rw->rw_object); + lock_profile_object_destroy(&rw->lock_object); + lock_destroy(&rw->lock_object); } void @@ -154,12 +154,12 @@ MPASS(curthread != NULL); KASSERT(rw_wowner(rw) != curthread, ("%s (%s): wlock already held @ %s:%d", __func__, - rw->rw_object.lo_name, file, line)); - WITNESS_CHECKORDER(&rw->rw_object, LOP_NEWORDER | LOP_EXCLUSIVE, file, + rw->lock_object.lo_name, file, line)); + WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER | LOP_EXCLUSIVE, file, line); __rw_wlock(rw, curthread, file, line); - LOCK_LOG_LOCK("WLOCK", &rw->rw_object, 0, 0, file, line); - WITNESS_LOCK(&rw->rw_object, LOP_EXCLUSIVE, file, line); + LOCK_LOG_LOCK("WLOCK", &rw->lock_object, 0, 0, file, line); + WITNESS_LOCK(&rw->lock_object, LOP_EXCLUSIVE, file, line); curthread->td_locks++; } @@ -170,9 +170,9 @@ MPASS(curthread != NULL); _rw_assert(rw, RA_WLOCKED, file, line); curthread->td_locks--; - WITNESS_UNLOCK(&rw->rw_object, LOP_EXCLUSIVE, file, line); - LOCK_LOG_LOCK("WUNLOCK", &rw->rw_object, 0, 0, file, line); - lock_profile_release_lock(&rw->rw_object); + WITNESS_UNLOCK(&rw->lock_object, LOP_EXCLUSIVE, file, line); + LOCK_LOG_LOCK("WUNLOCK", &rw->lock_object, 0, 0, file, line); + lock_profile_release_lock(&rw->lock_object); __rw_wunlock(rw, curthread, file, line); } @@ -188,8 +188,8 @@ KASSERT(rw_wowner(rw) != curthread, ("%s (%s): wlock already held @ %s:%d", __func__, - rw->rw_object.lo_name, file, line)); - WITNESS_CHECKORDER(&rw->rw_object, LOP_NEWORDER, file, line); + rw->lock_object.lo_name, file, line)); + WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER, file, line); /* * Note that we don't make any attempt to try to block read @@ -224,21 +224,21 @@ MPASS((x & RW_LOCK_READ_WAITERS) == 0); if (atomic_cmpset_acq_ptr(&rw->rw_lock, x, x + RW_ONE_READER)) { - if (LOCK_LOG_TEST(&rw->rw_object, 0)) + if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR4(KTR_LOCK, "%s: %p succeed %p -> %p", __func__, rw, (void *)x, (void *)(x + RW_ONE_READER)); if (RW_READERS(x) == 0) lock_profile_obtain_lock_success( - &rw->rw_object, contested, waittime, + &rw->lock_object, contested, waittime, file, line); break; } cpu_spinwait(); continue; } - lock_profile_obtain_lock_failed(&rw->rw_object, &contested, + lock_profile_obtain_lock_failed(&rw->lock_object, &contested, &waittime); /* @@ -246,7 +246,7 @@ * has a write lock, so acquire the turnstile lock so we can * begin the process of blocking. */ - turnstile_lock(&rw->rw_object); + turnstile_lock(&rw->lock_object); /* * The lock might have been released while we spun, so @@ -255,7 +255,7 @@ */ x = rw->rw_lock; if (x & RW_LOCK_READ) { - turnstile_release(&rw->rw_object); + turnstile_release(&rw->lock_object); cpu_spinwait(); continue; } @@ -269,11 +269,11 @@ if (!(x & RW_LOCK_READ_WAITERS)) { if (!atomic_cmpset_ptr(&rw->rw_lock, x, x | RW_LOCK_READ_WAITERS)) { - turnstile_release(&rw->rw_object); + turnstile_release(&rw->lock_object); cpu_spinwait(); continue; } - if (LOCK_LOG_TEST(&rw->rw_object, 0)) + if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR2(KTR_LOCK, "%s: %p set read waiters flag", __func__, rw); } @@ -286,8 +286,8 @@ */ owner = (struct thread *)RW_OWNER(x); if (TD_IS_RUNNING(owner)) { - turnstile_release(&rw->rw_object); - if (LOCK_LOG_TEST(&rw->rw_object, 0)) + turnstile_release(&rw->lock_object); + if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR3(KTR_LOCK, "%s: spinning on %p held by %p", __func__, rw, owner); while ((struct thread*)RW_OWNER(rw->rw_lock)== owner && @@ -301,11 +301,11 @@ * We were unable to acquire the lock and the read waiters * flag is set, so we must block on the turnstile. */ - if (LOCK_LOG_TEST(&rw->rw_object, 0)) + if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR2(KTR_LOCK, "%s: %p blocking on turnstile", __func__, rw); - turnstile_wait(&rw->rw_object, rw_owner(rw), TS_SHARED_QUEUE); - if (LOCK_LOG_TEST(&rw->rw_object, 0)) + turnstile_wait(&rw->lock_object, rw_owner(rw), TS_SHARED_QUEUE); + if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR2(KTR_LOCK, "%s: %p resuming from turnstile", __func__, rw); } @@ -316,8 +316,8 @@ * turnstile_wait() currently. */ - LOCK_LOG_LOCK("RLOCK", &rw->rw_object, 0, 0, file, line); - WITNESS_LOCK(&rw->rw_object, 0, file, line); + LOCK_LOG_LOCK("RLOCK", &rw->lock_object, 0, 0, file, line); + WITNESS_LOCK(&rw->lock_object, 0, file, line); curthread->td_locks++; } @@ -329,8 +329,8 @@ _rw_assert(rw, RA_RLOCKED, file, line); curthread->td_locks--; - WITNESS_UNLOCK(&rw->rw_object, 0, file, line); - LOCK_LOG_LOCK("RUNLOCK", &rw->rw_object, 0, 0, file, line); + WITNESS_UNLOCK(&rw->lock_object, 0, file, line); + LOCK_LOG_LOCK("RUNLOCK", &rw->lock_object, 0, 0, file, line); /* TODO: drop "owner of record" here. */ @@ -343,7 +343,7 @@ if (RW_READERS(x) > 1) { if (atomic_cmpset_ptr(&rw->rw_lock, x, x - RW_ONE_READER)) { - if (LOCK_LOG_TEST(&rw->rw_object, 0)) + if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR4(KTR_LOCK, "%s: %p succeeded %p -> %p", __func__, rw, (void *)x, @@ -377,7 +377,7 @@ MPASS(x == RW_READERS_LOCK(1)); if (atomic_cmpset_ptr(&rw->rw_lock, RW_READERS_LOCK(1), RW_UNLOCKED)) { - if (LOCK_LOG_TEST(&rw->rw_object, 0)) + if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR2(KTR_LOCK, "%s: %p last succeeded", __func__, rw); break; @@ -395,7 +395,7 @@ * Ok, we know we have a waiting writer and we think we * are the last reader, so grab the turnstile lock. */ - turnstile_lock(&rw->rw_object); + turnstile_lock(&rw->lock_object); /* * Try to drop our lock leaving the lock in a unlocked @@ -415,10 +415,10 @@ */ if (!atomic_cmpset_ptr(&rw->rw_lock, RW_READERS_LOCK(1) | RW_LOCK_WRITE_WAITERS, RW_UNLOCKED)) { - turnstile_release(&rw->rw_object); + turnstile_release(&rw->lock_object); continue; } - if (LOCK_LOG_TEST(&rw->rw_object, 0)) + if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR2(KTR_LOCK, "%s: %p last succeeded with waiters", __func__, rw); @@ -429,13 +429,13 @@ * block again if they run before the new lock holder(s) * release the lock. */ - ts = turnstile_lookup(&rw->rw_object); + ts = turnstile_lookup(&rw->lock_object); MPASS(ts != NULL); turnstile_broadcast(ts, TS_EXCLUSIVE_QUEUE); turnstile_unpend(ts, TS_SHARED_LOCK); break; } - lock_profile_release_lock(&rw->rw_object); + lock_profile_release_lock(&rw->lock_object); } /* @@ -451,12 +451,12 @@ #endif uintptr_t v; - if (LOCK_LOG_TEST(&rw->rw_object, 0)) + if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR5(KTR_LOCK, "%s: %s contested (lock=%p) at %s:%d", __func__, - rw->rw_object.lo_name, (void *)rw->rw_lock, file, line); + rw->lock_object.lo_name, (void *)rw->rw_lock, file, line); while (!_rw_write_lock(rw, tid)) { - turnstile_lock(&rw->rw_object); + turnstile_lock(&rw->lock_object); v = rw->rw_lock; /* @@ -464,7 +464,7 @@ * turnstile chain lock, try again. */ if (v == RW_UNLOCKED) { - turnstile_release(&rw->rw_object); + turnstile_release(&rw->lock_object); cpu_spinwait(); continue; } @@ -483,12 +483,12 @@ if (atomic_cmpset_acq_ptr(&rw->rw_lock, RW_UNLOCKED | RW_LOCK_WRITE_WAITERS, tid | RW_LOCK_WRITE_WAITERS)) { - turnstile_claim(&rw->rw_object); + turnstile_claim(&rw->lock_object); CTR2(KTR_LOCK, "%s: %p claimed by new writer", __func__, rw); break; } - turnstile_release(&rw->rw_object); + turnstile_release(&rw->lock_object); cpu_spinwait(); continue; } @@ -501,11 +501,11 @@ if (!(v & RW_LOCK_WRITE_WAITERS)) { if (!atomic_cmpset_ptr(&rw->rw_lock, v, v | RW_LOCK_WRITE_WAITERS)) { - turnstile_release(&rw->rw_object); + turnstile_release(&rw->lock_object); cpu_spinwait(); continue; } - if (LOCK_LOG_TEST(&rw->rw_object, 0)) + if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR2(KTR_LOCK, "%s: %p set write waiters flag", __func__, rw); } @@ -518,8 +518,8 @@ */ owner = (struct thread *)RW_OWNER(v); if (!(v & RW_LOCK_READ) && TD_IS_RUNNING(owner)) { - turnstile_release(&rw->rw_object); - if (LOCK_LOG_TEST(&rw->rw_object, 0)) + turnstile_release(&rw->lock_object); + if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR3(KTR_LOCK, "%s: spinning on %p held by %p", __func__, rw, owner); while ((struct thread*)RW_OWNER(rw->rw_lock)== owner && @@ -533,12 +533,12 @@ * We were unable to acquire the lock and the write waiters * flag is set, so we must block on the turnstile. */ - if (LOCK_LOG_TEST(&rw->rw_object, 0)) + if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR2(KTR_LOCK, "%s: %p blocking on turnstile", __func__, rw); - turnstile_wait(&rw->rw_object, rw_owner(rw), + turnstile_wait(&rw->lock_object, rw_owner(rw), TS_EXCLUSIVE_QUEUE); - if (LOCK_LOG_TEST(&rw->rw_object, 0)) + if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR2(KTR_LOCK, "%s: %p resuming from turnstile", __func__, rw); } @@ -559,11 +559,11 @@ KASSERT(rw->rw_lock & (RW_LOCK_READ_WAITERS | RW_LOCK_WRITE_WAITERS), ("%s: neither of the waiter flags are set", __func__)); - if (LOCK_LOG_TEST(&rw->rw_object, 0)) + if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR2(KTR_LOCK, "%s: %p contested", __func__, rw); - turnstile_lock(&rw->rw_object); - ts = turnstile_lookup(&rw->rw_object); + turnstile_lock(&rw->lock_object); + ts = turnstile_lookup(&rw->lock_object); #ifdef SMP /* @@ -573,9 +573,9 @@ */ if (ts == NULL) { atomic_store_rel_ptr(&rw->rw_lock, RW_UNLOCKED); - if (LOCK_LOG_TEST(&rw->rw_object, 0)) + if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR2(KTR_LOCK, "%s: %p no sleepers", __func__, rw); - turnstile_release(&rw->rw_object); + turnstile_release(&rw->lock_object); return; } #else @@ -624,7 +624,7 @@ * disown the turnstile and return. */ if (turnstile_empty(ts, queue)) { - if (LOCK_LOG_TEST(&rw->rw_object, 0)) + if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR2(KTR_LOCK, "%s: %p no sleepers 2", __func__, rw); atomic_store_rel_ptr(&rw->rw_lock, v); turnstile_disown(ts); @@ -633,7 +633,7 @@ #endif /* Wake up all waiters for the specific queue. */ - if (LOCK_LOG_TEST(&rw->rw_object, 0)) + if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR3(KTR_LOCK, "%s: %p waking up %s waiters", __func__, rw, >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200703212127.l2LLRCHr025409>