From owner-freebsd-scsi@FreeBSD.ORG Thu Feb 23 09:46:14 2012 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2733D106564A; Thu, 23 Feb 2012 09:46:14 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (mx0.hoeg.nl [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id D7AF08FC0A; Thu, 23 Feb 2012 09:46:13 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id BCC462A28CB7; Thu, 23 Feb 2012 10:46:11 +0100 (CET) Date: Thu, 23 Feb 2012 10:46:11 +0100 From: Ed Schouten To: "Desai, Kashyap" Message-ID: <20120223094611.GC32748@hoeg.nl> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="KN5l+BnMqAQyZLvT" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-stable , "joerg@FreeBSD.org" , "Kenneth D. Merry" , "freebsd-scsi@freebsd.org" , "Justin T. Gibbs" , "McConnell, Stephen" Subject: Re: mpslsi0 : Trying sleep, but thread marked as sleeping prohibited X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Feb 2012 09:46:14 -0000 --KN5l+BnMqAQyZLvT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Kashyap, * Desai, Kashyap , 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 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--