summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mutex.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2008-02-13 23:33:50 +0000
committerjhb <jhb@FreeBSD.org>2008-02-13 23:33:50 +0000
commit64735ffb5f5be8bf62c36fbacca07d713ec8da82 (patch)
tree511e1ad3022734f5e06477f983809e3c3fa76105 /sys/kern/kern_mutex.c
parentf8f681d2a24182882bd5b763408c6d9bbf96a25b (diff)
downloadFreeBSD-src-64735ffb5f5be8bf62c36fbacca07d713ec8da82.zip
FreeBSD-src-64735ffb5f5be8bf62c36fbacca07d713ec8da82.tar.gz
Add a couple of assertions and KTR logging to thread_lock_flags() to
match mtx_lock_spin_flags(). MFC after: 1 week
Diffstat (limited to 'sys/kern/kern_mutex.c')
-rw-r--r--sys/kern/kern_mutex.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 81be32d..b770165 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -485,7 +485,6 @@ _thread_lock_flags(struct thread *td, int opts, const char *file, int line)
int i, contested;
uint64_t waittime;
-
contested = i = 0;
waittime = 0;
tid = (uintptr_t)curthread;
@@ -493,6 +492,11 @@ _thread_lock_flags(struct thread *td, int opts, const char *file, int line)
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));
WITNESS_CHECKORDER(&m->lock_object,
opts | LOP_NEWORDER | LOP_EXCLUSIVE, file, line);
while (!_obtain_lock(m, tid)) {
@@ -525,6 +529,8 @@ retry:
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);
}
OpenPOWER on IntegriCloud