diff options
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_lock.c | 22 | ||||
-rw-r--r-- | sys/kern/kern_mutex.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_rwlock.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_sx.c | 2 | ||||
-rw-r--r-- | sys/kern/subr_lock.c | 7 |
5 files changed, 22 insertions, 13 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 952167aeea8f..2e010b7df899 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -62,8 +62,19 @@ __FBSDID("$FreeBSD$"); #ifdef DDB #include <ddb/ddb.h> +static void db_show_lockmgr(struct lock_object *lock); #endif + +struct lock_class lock_class_lockmgr = { + "lockmgr", + LC_SLEEPLOCK | LC_SLEEPABLE | LC_RECURSABLE | LC_UPGRADABLE, +#ifdef DDB + db_show_lockmgr +#endif +}; + + /* * Locking primitives implementation. * Locks provide shared/exclusive sychronization. @@ -166,8 +177,6 @@ _lockmgr(struct lock *lkp, int flags, struct mtx *interlkp, thr = td; lock_profile_waitstart(&waitstart); - - lkp->lk_object.lo_type = "lockmgr"; if ((flags & LK_INTERNAL) == 0) mtx_lock(lkp->lk_interlock); CTR6(KTR_LOCK, @@ -523,7 +532,7 @@ lockinit(lkp, prio, wmesg, timo, flags) #ifdef DEBUG_LOCKS stack_zero(&lkp->lk_stack); #endif - lock_profile_object_init(&lkp->lk_object, wmesg); + lock_profile_object_init(&lkp->lk_object, &lock_class_lockmgr, wmesg); } /* @@ -648,14 +657,13 @@ lockmgr_chain(struct thread *td, struct thread **ownerp) return (1); } -DB_SHOW_COMMAND(lockmgr, db_show_lockmgr) +void +db_show_lockmgr(struct lock_object *lock) { struct thread *td; struct lock *lkp; - if (!have_addr) - return; - lkp = (struct lock *)addr; + lkp = (struct lock *)lock; db_printf("lock type: %s\n", lkp->lk_wmesg); db_printf("state: "); diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index b4ec84390950..ef8b5f331184 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -656,7 +656,7 @@ 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->mtx_object, name); + lock_profile_object_init(&m->mtx_object, class, name); lock_init(&m->mtx_object, class, name, type, flags); } diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c index 96ed3f0aaeb8..82535fe56d12 100644 --- a/sys/kern/kern_rwlock.c +++ b/sys/kern/kern_rwlock.c @@ -86,7 +86,7 @@ rw_init(struct rwlock *rw, const char *name) rw->rw_lock = RW_UNLOCKED; - lock_profile_object_init(&rw->rw_object, name); + lock_profile_object_init(&rw->rw_object, &lock_class_rw, name); lock_init(&rw->rw_object, &lock_class_rw, name, NULL, LO_WITNESS | LO_RECURSABLE | LO_UPGRADABLE); } diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c index 23fdb72455e7..ecab0e91a599 100644 --- a/sys/kern/kern_sx.c +++ b/sys/kern/kern_sx.c @@ -86,7 +86,7 @@ sx_init(struct sx *sx, const char *description) cv_init(&sx->sx_excl_cv, description); sx->sx_excl_wcnt = 0; sx->sx_xholder = NULL; - lock_profile_object_init(&sx->sx_object, description); + lock_profile_object_init(&sx->sx_object, &lock_class_sx, description); lock_init(&sx->sx_object, &lock_class_sx, description, NULL, LO_WITNESS | LO_RECURSABLE | LO_SLEEPABLE | LO_UPGRADABLE); } diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c index 94e7d8819a33..adf5e594ba1a 100644 --- a/sys/kern/subr_lock.c +++ b/sys/kern/subr_lock.c @@ -58,6 +58,7 @@ struct lock_class *lock_classes[LOCK_CLASS_MAX + 1] = { &lock_class_mtx_sleep, &lock_class_sx, &lock_class_rw, + &lock_class_lockmgr, }; #ifdef LOCK_PROFILING @@ -305,9 +306,9 @@ void _lock_profile_update_wait(struct lock_object *lo, uint64_t waitstart) } mpp->file = p; mpp->line = l->lpo_lineno; - mpp->name = lo->lo_name; - mpp->type = lo->lo_type; mpp->namehash = l->lpo_namehash; + mpp->type = l->lpo_type; + mpp->name = lo->lo_name; if (collision) ++lock_prof_collisions; /* We might have raced someone else but who cares, they'll try again next time */ @@ -368,7 +369,7 @@ void _lock_profile_release_lock(struct lock_object *lo) mpp->file = p; mpp->line = l->lpo_lineno; mpp->namehash = l->lpo_namehash; - mpp->type = lo->lo_type; + mpp->type = l->lpo_type; mpp->name = lo->lo_name; if (collision) |