Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Aug 2004 11:00:06 +0200
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        freebsd-current@freebsd.org
Subject:   Bogus usage of tsleep(9) in USB.
Message-ID:  <20040820090006.GX30151@darkness.comp.waw.pl>

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

--wwSFAA0Com6UqrPP
Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi.

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:

        KASSERT(timo !=3D 0 || mtx_owned(&Giant) || mtx !=3D NULL,
            ("sleeping without a mutex"));

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, "ugen=
ri", 0);
ugen.c:697:                     error =3D tsleep(sce, PZERO | PCATCH, "ugen=
ri", 0);
uhci.c:1982:    tsleep(&sc->sc_softwake, PZERO, "uhciab", 0);
uhid.c:496:             error =3D tsleep(&sc->sc_q, PZERO | PCATCH, "uhidre=
a", 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, "usbr=
ea", 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);

I saw only panic on tsleep(9) from usbdi.c, so I know for sure we don't
hold Giant there.

--=20
Pawel Jakub Dawidek                       http://www.FreeBSD.org
pjd@FreeBSD.org                           http://garage.freebsd.pl
FreeBSD committer                         Am I Evil? Yes, I Am!

--wwSFAA0Com6UqrPP
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iD8DBQFBJb2WForvXbEpPzQRApBKAJ9p2Zh1qTfX0eL6+0DH5+GMYOWzFgCfRRHN
KETi48tnhvQZDNU2bgz+hto=
=Ah9L
-----END PGP SIGNATURE-----

--wwSFAA0Com6UqrPP--



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