diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index 143e38c7715f..d48bf2e94f34 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -639,8 +639,8 @@ _callout_init_lock(c, lock, flags) ("callout_init_lock: bad flags %d", flags)); KASSERT(lock != NULL || (flags & CALLOUT_RETURNUNLOCKED) == 0, ("callout_init_lock: CALLOUT_RETURNUNLOCKED with no lock")); - KASSERT(lock == NULL || LOCK_CLASS(lock) == &lock_class_mtx_sleep || - LOCK_CLASS(lock) == &lock_class_rw, ("%s: invalid lock class", + KASSERT(lock == NULL || !(LOCK_CLASS(lock)->lc_flags & + (LC_SPINLOCK | LC_SLEEPABLE)), ("%s: invalid lock class", __func__)); c->c_flags = flags & (CALLOUT_RETURNUNLOCKED | CALLOUT_SHAREDLOCK); } diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c index b236f8db903a..74a4148e9de4 100644 --- a/sys/kern/subr_lock.c +++ b/sys/kern/subr_lock.c @@ -494,7 +494,7 @@ lock_profile_obtain_lock_success(struct lock_object *lo, int contested, if (lock_prof_skipcount && (++lock_prof_count % lock_prof_skipcount) != 0) return; - spin = LOCK_CLASS(lo) == &lock_class_mtx_spin; + spin = (LOCK_CLASS(lo)->lc_flags & LC_SPINLOCK) ? 1 : 0; if (spin && lock_prof_skipspin == 1) return; l = lock_profile_object_lookup(lo, spin, file, line); @@ -523,7 +523,7 @@ lock_profile_release_lock(struct lock_object *lo) if (!lock_prof_enable || (lo->lo_flags & LO_NOPROFILE)) return; - spin = LOCK_CLASS(lo) == &lock_class_mtx_spin; + spin = (LOCK_CLASS(lo)->lc_flags & LC_SPINLOCK) ? 1 : 0; head = &curthread->td_lprof[spin]; critical_enter(); LIST_FOREACH(l, head, lpo_link)