Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Feb 2012 10:46:11 +0100
From:      Ed Schouten <ed@80386.nl>
To:        "Desai, Kashyap" <Kashyap.Desai@lsi.com>
Cc:        freebsd-stable <freebsd-stable@freebsd.org>, "joerg@FreeBSD.org" <joerg@FreeBSD.org>, "Kenneth D. Merry" <ken@freebsd.org>, "freebsd-scsi@freebsd.org" <freebsd-scsi@freebsd.org>, "Justin T. Gibbs" <gibbs@freebsd.org>, "McConnell, Stephen" <Stephen.McConnell@lsi.com>
Subject:   Re: mpslsi0 : Trying sleep, but thread marked as sleeping prohibited
Message-ID:  <20120223094611.GC32748@hoeg.nl>
In-Reply-To: <B2FD678A64EAAD45B089B123FDFC3ED72B96D3484A@inbmail01.lsi.com>
References:  <B2FD678A64EAAD45B089B123FDFC3ED72B96D3484A@inbmail01.lsi.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--KN5l+BnMqAQyZLvT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Kashyap,

* Desai, Kashyap <Kashyap.Desai@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.
>=20
>=20
>     mps_dprint(sc, MPS_TRACE, "%s\n", __func__);
>     mps_lock(sc);
>     mps_intr_locked(data);
>     mps_unlock(sc);
>=20
> 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.

--=20
 Ed Schouten <ed@80386.nl>
 WWW: http://80386.nl/

--KN5l+BnMqAQyZLvT
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (FreeBSD)

iQIcBAEBAgAGBQJPRgrjAAoJEG5e2P40kaK7Wk4P/RSI//kT8DyA0dSBCZbSyA74
CA94Gxdd6NE+O5BVcgqdylN9v8Zp4eQ0QWhg/jYOWZR0VqH0o8hLbF9rICj1k9TV
S6i7xNT+9weMo45fQaWJM4iyEW5J+S+mhm2qvxMEx2Goy0nMSS9vfQ/oU/ouZ6Nh
Hz5lSjTefG7Bv6YIbKMeNder+RhbKl82yxbMGlfvLQwbPcQD+VRzD0sY/vD9neuB
UneFt41BWytryGsh5jc3qNlWq3aP0xb/QGOmMwQKXBfrhgDCDWO1X4h5JmrUoLG0
UwGa1ForcdEVGoNSbFqkHThq0pPqEgUWaP+kCrsr565d6wh/dTuBzf+l2+788oT7
8XxNVtPfmcKevFJISMmFT/YyvNoYIIkzVdSN/kNf3LZHX/iawptbeFylwd0FB0GM
ITw15B4oGp6zUi9oZMR5hTayUW5UZM88jIxlSEgXsqN/ipLZeWl5JNVSjQDbH2tK
A+AsDtqGybM5YZoDVoHFkl3LhoRBkxMiPdowl9geAD7rZxdK/EA6znUa6ojpsaGw
nNBIUPFAW/dogxNMky461hhb1D77BzwY6fObPY9B71wiXV/cyEAUeVLP1dQ9Fn2Y
2xL3Mei7fVS101OgARK854bddQc8schDoETQk+O54o//JkDypSpjC9nUd6DWXjHN
Zt7ZGjMJOjOfAHsksMl5
=+cMB
-----END PGP SIGNATURE-----

--KN5l+BnMqAQyZLvT--



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