propagate_priority KASSERT

Mark Gooderum mark at verniernetworks.com
Tue Nov 23 19:21:52 PST 2004


We're currently tripping accross the following KASSERT in 
subr_turnstile.c (in 5.3.0 RELEASE):

        /*
         * XXX: The owner of a turnstile can be stale if it is the
         * first thread to grab a slock of a sx lock.  In that case
         * it is possible for us to be at SSLEEP or some other
         * weird state.  We should probably just return if the state
         * isn't SRUN or SLOCK.
         */
        KASSERT(!TD_IS_SLEEPING(td),
            ("sleeping thread %p (pid %d) owns non-sleepable lock %p",
             td, td->td_proc->p_pid, ts))

This is in propagate_priority().

However, propagate_priority() is only called in one place, by 
turnstile_wait(), and turnstile_wait() in turn is only called by 
_mtx_lock_sleep() which in turn is only used for sleep mutexes.

TD_IS_SLEEPING() really means the SLEEPING inhibitor is set which in 
turn seems to mean that thread is in fact on a sleepq - which is used 
for various wait channels and timeouts.

So I'm just trying to understand why it's a 100% assertion for any 
holder of the turnstile for a sleep mutex sleeping.

Thanks,
--
Mark Gooderum
Vernier Networks, Inc.
mark at verniernetworks.com



More information about the freebsd-stable mailing list