PERFORCE change 135352 for review
Attilio Rao
attilio at freebsd.org
Wed Feb 13 15:38:12 PST 2008
2008/2/14, John Baldwin <jhb at freebsd.org>:
> 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,
Wouldn't be better to check against LC_SPINLOCK for the lock class?
Attilio
--
Peace can only be achieved by understanding - A. Einstein
More information about the p4-projects
mailing list