PERFORCE change 135352 for review
John Baldwin
jhb at FreeBSD.org
Wed Feb 13 15:02:14 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=135352
Change 135352 by jhb at jhb_mutex on 2008/02/13 23:01:15
Add missing assertions and KTR logging to thread_lock(). This is
why I wasn't getting assertion failures when thread_lock() recursed
on a non-recursive spin mutex.
Affected files ...
.. //depot/projects/smpng/sys/kern/kern_mutex.c#151 edit
Differences ...
==== //depot/projects/smpng/sys/kern/kern_mutex.c#151 (text+ko) ====
@@ -498,7 +498,6 @@
int i, contested;
uint64_t waittime;
-
contested = i = 0;
waittime = 0;
tid = (uintptr_t)curthread;
@@ -506,6 +505,15 @@
retry:
spinlock_enter();
m = td->td_lock;
+ KASSERT(m->mtx_lock != MTX_DESTROYED,
+ ("thread_lock() of destroyed mutex @ %s:%d", file, line));
+ KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_spin,
+ ("thread_lock() of sleep mutex %s @ %s:%d",
+ m->lock_object.lo_name, file, line));
+ if (mtx_owned(m))
+ KASSERT((m->lock_object.lo_flags & LO_RECURSABLE) != 0,
+ ("thread_lock: recursed on non-recursive mutex %s @ %s:%d\n",
+ m->lock_object.lo_name, file, line));
WITNESS_CHECKORDER(&m->lock_object,
opts | LOP_NEWORDER | LOP_EXCLUSIVE, file, line);
while (!_obtain_lock(m, tid)) {
@@ -538,6 +546,8 @@
if (m->mtx_recurse == 0)
lock_profile_obtain_lock_success(&m->lock_object, contested,
waittime, (file), (line));
+ LOCK_LOG_LOCK("LOCK", &m->lock_object, opts, m->mtx_recurse, file,
+ line);
WITNESS_LOCK(&m->lock_object, opts | LOP_EXCLUSIVE, file, line);
}
More information about the p4-projects
mailing list