Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Feb 2008 00:10:09 +0100
From:      "Attilio Rao" <attilio@freebsd.org>
To:        "John Baldwin" <jhb@freebsd.org>
Cc:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   Re: PERFORCE change 135352 for review
Message-ID:  <3bbf2fe10802131510h400d0777yd758bfbaf780f895@mail.gmail.com>
In-Reply-To: <200802132302.m1DN2D9d055694@repoman.freebsd.org>
References:  <200802132302.m1DN2D9d055694@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
2008/2/14, John Baldwin <jhb@freebsd.org>:
> http://perforce.freebsd.org/chv.cgi?CH=135352
>
>  Change 135352 by jhb@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3bbf2fe10802131510h400d0777yd758bfbaf780f895>