diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 58c13e5a7bfb..2203c215a189 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -550,7 +550,6 @@ lockinit(lkp, prio, wmesg, timo, flags) #ifdef DEBUG_LOCKS stack_zero(&lkp->lk_stack); #endif - lock_profile_object_init(&lkp->lk_object, &lock_class_lockmgr, wmesg); lock_init(&lkp->lk_object, &lock_class_lockmgr, wmesg, NULL, LO_RECURSABLE | LO_SLEEPABLE | LO_UPGRADABLE); } @@ -562,9 +561,9 @@ void lockdestroy(lkp) struct lock *lkp; { + CTR2(KTR_LOCK, "lockdestroy(): lkp == %p (lk_wmesg == \"%s\")", lkp, lkp->lk_wmesg); - lock_profile_object_destroy(&lkp->lk_object); lock_destroy(&lkp->lk_object); } diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index e088802064cc..fa498b552450 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -711,7 +711,6 @@ mtx_init(struct mtx *m, const char *name, const char *type, int opts) m->mtx_lock = MTX_UNOWNED; m->mtx_recurse = 0; - lock_profile_object_init(&m->lock_object, class, name); lock_init(&m->lock_object, class, name, type, flags); } @@ -742,7 +741,6 @@ mtx_destroy(struct mtx *m) } m->mtx_lock = MTX_DESTROYED; - lock_profile_object_destroy(&m->lock_object); lock_destroy(&m->lock_object); } diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c index 1a3a11fe4773..1b1113e7c45a 100644 --- a/sys/kern/kern_rwlock.c +++ b/sys/kern/kern_rwlock.c @@ -123,7 +123,6 @@ rw_init(struct rwlock *rw, const char *name) rw->rw_lock = RW_UNLOCKED; - 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); } @@ -134,7 +133,6 @@ rw_destroy(struct rwlock *rw) KASSERT(rw->rw_lock == RW_UNLOCKED, ("rw lock not unlocked")); rw->rw_lock = RW_DESTROYED; - lock_profile_object_destroy(&rw->lock_object); lock_destroy(&rw->lock_object); } diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c index 0204e6a27a8a..c6f87f3f5a3a 100644 --- a/sys/kern/kern_sx.c +++ b/sys/kern/kern_sx.c @@ -183,7 +183,6 @@ sx_init_flags(struct sx *sx, const char *description, int opts) flags |= opts & SX_ADAPTIVESPIN; sx->sx_lock = SX_LOCK_UNLOCKED; sx->sx_recurse = 0; - lock_profile_object_init(&sx->lock_object, &lock_class_sx, description); lock_init(&sx->lock_object, &lock_class_sx, description, NULL, flags); } @@ -194,7 +193,6 @@ sx_destroy(struct sx *sx) KASSERT(sx->sx_lock == SX_LOCK_UNLOCKED, ("sx lock still held")); KASSERT(sx->sx_recurse == 0, ("sx lock still recursed")); sx->sx_lock = SX_LOCK_DESTROYED; - lock_profile_object_destroy(&sx->lock_object); lock_destroy(&sx->lock_object); } diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c index dfbcb25a7e50..7393054ba270 100644 --- a/sys/kern/subr_lock.c +++ b/sys/kern/subr_lock.c @@ -215,6 +215,7 @@ lock_init(struct lock_object *lock, struct lock_class *class, const char *name, lock->lo_flags |= flags | LO_INITIALIZED; LOCK_LOG_INIT(lock, 0); WITNESS_INIT(lock); + lock_profile_object_init(lock, class, name); } void @@ -222,6 +223,7 @@ lock_destroy(struct lock_object *lock) { KASSERT(lock_initalized(lock), ("lock %p is not initialized", lock)); + lock_profile_object_destroy(lock); WITNESS_DESTROY(lock); LOCK_LOG_DESTROY(lock, 0); lock->lo_flags &= ~LO_INITIALIZED;