> -----Original Message-----
> From: Ed Schouten [mailto:[email protected]]
> Sent: Thursday, February 23, 2012 3:16 PM
> To: Desai, Kashyap
> Cc: [email protected]; freebsd-stable; [email protected]; Kenneth
> D. Merry; McConnell, Stephen; Justin T. Gibbs
> Subject: Re: mpslsi0 : Trying sleep, but thread marked as sleeping
> prohibited
> 
> Hi Kashyap,
> 
> * Desai, Kashyap <[email protected]>, 20120222 18:51:
> > Adding Ed Schouten and Jorg Wunsch  as I see there are author of
> > msleep/mtx related APIs.
> 
> Am I? :-)
I am new to FreeBSD and desperate to know the answer. :-). Thanks for your help.
> 
> > 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.
So does this assumption that another thread will release mutex fast enough ?
Same as msleep() this can be applicable here as well. I mean another thread  
_can_ (if some bad drivers) take long time to release mutex.

> 
> > 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.
This part is clear. ! I agree with all experts view. 
> 
> --
>  Ed Schouten <[email protected]>
>  WWW: http://80386.nl/
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[email protected]"

Reply via email to