mpslsi0 : Trying sleep, but thread marked as sleeping prohibited

Ed Schouten ed at 80386.nl
Thu Feb 23 09:46:14 UTC 2012


Hi Kashyap,

* Desai, Kashyap <Kashyap.Desai at lsi.com>, 20120222 18:51:
> Adding Ed Schouten and Jorg Wunsch  as I see there are author of
> msleep/mtx related APIs.

Am I? :-)

> 1. When any irq is register with FreeBSD OS, it sets " TDP_NOSLEEPING"
> pflag. It means though irq in freebsd is treated as thread,
> We cannot sleep in IRQ because of " "TDP_NOSLEEPING " set.
> 2. In mps driver we have below code snippet in ISR routine.
> 
> 
>     mps_dprint(sc, MPS_TRACE, "%s\n", __func__);
>     mps_lock(sc);
>     mps_intr_locked(data);
>     mps_unlock(sc);
> 
> I wonder why there is no issue with above code ? Theoretical we cannot
> sleep in ISR. (as explained in #1)
> Any thoughts ?

The TDP_NOSLEEPING flag only disallows sleeping of an indeterminate
amount of time. Locking a mutex is allowed, as it can only cause the
thread to be blocked for a small amount of time, waiting for another
thread to unlock it.

> 3. I recently added few place msleep() instead of DELAY in ISR context
> and I see
> " Trying sleep, but thread marked as sleeping prohibited".

Which makes sense, as msleep() can be used to sleep for indefinitely.

-- 
 Ed Schouten <ed at 80386.nl>
 WWW: http://80386.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-scsi/attachments/20120223/f25e175e/attachment.pgp


More information about the freebsd-scsi mailing list