Date: Thu, 11 Sep 2008 23:46:58 +0200 From: Hans Petter Selasky <hselasky@c2i.net> To: freebsd-usb@freebsd.org Cc: Volker <volker@vwsoft.com>, Julian Elischer <julian@elischer.org>, Antony Mawer <fbsd-current@mawer.org> Subject: Re: usbdrain problem (was: Re: "legacy" usb stack fixes) Message-ID: <200809112347.00510.hselasky@c2i.net> In-Reply-To: <200809112320.25758.hselasky@c2i.net> References: <20080819211814.6CD685B4D@mail.bitblocks.com> <48C98043.3040807@vwsoft.com> <200809112320.25758.hselasky@c2i.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Volker, Could you try the following. Add an extra check for "UGEN_CLOSING" to the code statement in ugen.c in the function ugenclose(): if ((!(sce->state & UGEN_CLOSING)) && (sce->state & (UGEN_OPEN_DEV | UGEN_OPEN_IN | UGEN_OPEN_OUT)) .... The ugenclose() is called from both "detach()" and "close()" and maybe there is a race there! --HPS static int ugenclose(struct cdev *dev, int flag, int mode, struct thread *p) { struct ugen_softc *sc = DEV2SC(dev); struct ugen_endpoint *sce = DEV2SCE(dev); struct usbd_xfer *temp_xfer[4]; int32_t error; PRINTFN(5, ("flag=%d, mode=%d\n", flag, mode)); if ((sc == NULL) || (sce == NULL)) { return (0); } mtx_lock(&sc->sc_mtx); here >>> if (sce->state & (UGEN_OPEN_DEV | UGEN_OPEN_IN | UGEN_OPEN_OUT)) { /* control endpoint is also ``closed'' here */ sce->state |= UGEN_CLOSING; On Thursday 11 September 2008, Hans Petter Selasky wrote: > On Thursday 11 September 2008, Volker wrote: > > On 09/11/08 22:13, Julian Elischer wrote: > > > Volker wrote: > > >> On 09/11/08 10:13, Hans Petter Selasky wrote: > > >>> On Monday 25 August 2008, Volker wrote: > > >>>> Anyway, I've already had those crashes even with the "new" usb stack > > >>>> (but it doesn't happen everytime - YMMV). > > >> > > >> // dropped current@ from CC > > >> > > >> Hans Petter, > > >> > > >> the device unplug problem is not just with usb, but these devices are > > >> the most frequent unplugged devices so far. > > >> > > >> Early this week, I discovered a new problem. I've fetched fresh > > >> RELENG_7 sources, patched your usb stack in and recompiled kernel > > >> (using usb, not usb2). > > Hi Volker, > > There has been significant changes to ugen between usb and usb2. > > It looks to me like that ugen started the transfer again after the USB > transfer drain process started, so the drain will never exit. Probably it > could need an extra flag there to catch that case, to prevent the start > after trying to unsetup the transfer! > > Try to turn on USB debugging: > > sysctl hw.usb.debug=15 > > And grep for transfer start and stop. > > --HPS > _______________________________________________ > freebsd-usb@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-usb > To unsubscribe, send any mail to "freebsd-usb-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809112347.00510.hselasky>