From owner-freebsd-current@FreeBSD.ORG Fri Aug 20 09:09:37 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 871C616A4CE for ; Fri, 20 Aug 2004 09:09:37 +0000 (GMT) Received: from darkness.comp.waw.pl (darkness.comp.waw.pl [195.117.238.236]) by mx1.FreeBSD.org (Postfix) with ESMTP id 62EE543D41 for ; Fri, 20 Aug 2004 09:09:36 +0000 (GMT) (envelope-from pjd@darkness.comp.waw.pl) Received: by darkness.comp.waw.pl (Postfix, from userid 1009) id E2DF9AC977; Fri, 20 Aug 2004 11:09:31 +0200 (CEST) Date: Fri, 20 Aug 2004 11:09:31 +0200 From: Pawel Jakub Dawidek To: freebsd-current@freebsd.org Message-ID: <20040820090931.GY30151@darkness.comp.waw.pl> References: <20040820090006.GX30151@darkness.comp.waw.pl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Re7H+V5lQR2Zv/pu" Content-Disposition: inline In-Reply-To: <20040820090006.GX30151@darkness.comp.waw.pl> User-Agent: Mutt/1.4.2i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 5.2.1-RC2 i386 Subject: Re: Bogus usage of tsleep(9) in USB. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2004 09:09:37 -0000 --Re7H+V5lQR2Zv/pu Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 20, 2004 at 11:00:06AM +0200, Pawel Jakub Dawidek wrote: +> There are many calls to tsleep(9) with no timeout in our USB code. +> As you all know, it is not permitted and we have KASSERT() for this: +>=20 +> KASSERT(timo !=3D 0 || mtx_owned(&Giant) || mtx !=3D NULL, +> ("sleeping without a mutex")); +>=20 +> ehci.c:2441: tsleep(&sc->sc_softwake, PZERO, "ehciab", 0); +> ohci.c:2288: tsleep(&sc->sc_softwake, PZERO, "ohciab", 0); +> ubser.c:882: tsleep(&sc->sc_opening, PRIBIO, "ubser_op", 0); +> ucom.c:275: tsleep(&sc->sc_opening, PRIBIO, "ucomop", 0); +> ugen.c:633: error =3D tsleep(sce, PZERO | PCATCH, "u= genri", 0); +> ugen.c:697: error =3D tsleep(sce, PZERO | PCATCH, "u= genri", 0); +> uhci.c:1982: tsleep(&sc->sc_softwake, PZERO, "uhciab", 0); +> uhid.c:496: error =3D tsleep(&sc->sc_q, PZERO | PCATCH, "uhi= drea", 0); +> ums.c:639: error =3D tsleep(sc, PZERO | PCATCH, "umsrea", 0= ); +> usb.c:456: tsleep(&usb_all_tasks, PWAIT, "usbtsk", = 0); +> usb.c:534: error =3D tsleep(&usb_events, PZERO | PCATCH, "u= sbrea", 0); +> usbdi.c:342: tsleep(xfer, PRIBIO, "usbsyn", 0); +> usbdi_util.c:435: error =3D tsleep(xfer, PZERO | PCATCH, lbl, 0); +> usbdi_util.c:477: error =3D tsleep(xfer, PZERO | PCATCH, lbl, 0); +>=20 +> I saw only panic on tsleep(9) from usbdi.c, so I know for sure we don't +> hold Giant there. BTW. It looks there are more interesting places: anger:root:~# egrep -r 'tsleep.*[^0-9]0\)' /sys/ | wc -l 123 I don't know where we hold Giant, but I'm quite sure not everywhere. --=20 Pawel Jakub Dawidek http://www.FreeBSD.org pjd@FreeBSD.org http://garage.freebsd.pl FreeBSD committer Am I Evil? Yes, I Am! --Re7H+V5lQR2Zv/pu Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFBJb/LForvXbEpPzQRAqR5AKDCAw0BNqesifGKWgRnBcZ9VTZX8QCdFZWw an9d87xljp/2efqHg91DXsk= =e7vn -----END PGP SIGNATURE----- --Re7H+V5lQR2Zv/pu--