Really, no explicit checks against against lock_class_* object should be
done in consumers code: using locks properties is much more appropriate. Fix current code doing these bogus checks. Note: Really, callout are not usable by all !(LC_SPINLOCK | LC_SLEEPABLE) primitives like rmlocks doesn't implement the generic lock layer functions, but they can be equipped for this, so the check is still valid. Tested by: matteo, kris (earlier version) Reviewed by: jhb
This commit is contained in:
parent
7a21dee3c2
commit
13ddf72de7
@ -639,8 +639,8 @@ _callout_init_lock(c, lock, flags)
|
|||||||
("callout_init_lock: bad flags %d", flags));
|
("callout_init_lock: bad flags %d", flags));
|
||||||
KASSERT(lock != NULL || (flags & CALLOUT_RETURNUNLOCKED) == 0,
|
KASSERT(lock != NULL || (flags & CALLOUT_RETURNUNLOCKED) == 0,
|
||||||
("callout_init_lock: CALLOUT_RETURNUNLOCKED with no lock"));
|
("callout_init_lock: CALLOUT_RETURNUNLOCKED with no lock"));
|
||||||
KASSERT(lock == NULL || LOCK_CLASS(lock) == &lock_class_mtx_sleep ||
|
KASSERT(lock == NULL || !(LOCK_CLASS(lock)->lc_flags &
|
||||||
LOCK_CLASS(lock) == &lock_class_rw, ("%s: invalid lock class",
|
(LC_SPINLOCK | LC_SLEEPABLE)), ("%s: invalid lock class",
|
||||||
__func__));
|
__func__));
|
||||||
c->c_flags = flags & (CALLOUT_RETURNUNLOCKED | CALLOUT_SHAREDLOCK);
|
c->c_flags = flags & (CALLOUT_RETURNUNLOCKED | CALLOUT_SHAREDLOCK);
|
||||||
}
|
}
|
||||||
|
@ -494,7 +494,7 @@ lock_profile_obtain_lock_success(struct lock_object *lo, int contested,
|
|||||||
if (lock_prof_skipcount &&
|
if (lock_prof_skipcount &&
|
||||||
(++lock_prof_count % lock_prof_skipcount) != 0)
|
(++lock_prof_count % lock_prof_skipcount) != 0)
|
||||||
return;
|
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)
|
if (spin && lock_prof_skipspin == 1)
|
||||||
return;
|
return;
|
||||||
l = lock_profile_object_lookup(lo, spin, file, line);
|
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))
|
if (!lock_prof_enable || (lo->lo_flags & LO_NOPROFILE))
|
||||||
return;
|
return;
|
||||||
spin = LOCK_CLASS(lo) == &lock_class_mtx_spin;
|
spin = (LOCK_CLASS(lo)->lc_flags & LC_SPINLOCK) ? 1 : 0;
|
||||||
head = &curthread->td_lprof[spin];
|
head = &curthread->td_lprof[spin];
|
||||||
critical_enter();
|
critical_enter();
|
||||||
LIST_FOREACH(l, head, lpo_link)
|
LIST_FOREACH(l, head, lpo_link)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user