Date: Sat, 2 Apr 2005 12:36:25 +0200 From: Bernd Walter <ticso@cicely12.cicely.de> To: Warner Losh <imp@bsdimp.com> Cc: freebsd-usb@FreeBSD.ORG Subject: Re: panic: uhci_abort_xfer: not in process context Message-ID: <20050402103624.GS2072@cicely12.cicely.de> In-Reply-To: <20050401.150254.74727545.imp@bsdimp.com> References: <200504012144.11468.sebastien.b@swissinfo.org> <200504012317.54966.hselasky@c2i.net> <20050401213138.GQ2072@cicely12.cicely.de> <20050401.150254.74727545.imp@bsdimp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Apr 01, 2005 at 03:02:54PM -0700, Warner Losh wrote: > > > The solution is to use DELAY() instead of tsleep() and usb_delay_ms(). > > > > This is wrong either way - wasting cycles in interrupt context is bad. > > IMO the timeout function should trigger a softint doing the real job. > > Maybe Ian has an idea about this - he did a lot in respect to timeout > > and aborting xfers lately and should be familar with this point. > > To be shure it still exists you should verify with latest code. > > I have a set of patches that convert the bridge interrupt routines > into a taskqueue. I did that so that we can mark them as non-giant > holding ISRs. This would be a reasonable context to do things like > sleeping from. However, you'd want to avoid that as much as possible > because sleeping for one request would block all the others in the > queue.... bridge = host controller? Sounds interesting. But I also don't understand the panic either. Timeouts seem to be handled but usbtask already, but this isn't a timeout anyway. It is aborting the receive xfer on ucom close and this is triggered by a userland close(2) call - no interrupt. In ohci.c it does: if (xfer->device->bus->intr_context || !curproc) panic("ohci_abort_xfer: not in process context"); OK - this one is from ohci, but they are all the same. intr_context is raised on interrupt handler start and decreased later. It seems that there is an artifical limitation that we are not allowed to sleep when processing USB interrupts. If one really goes to sleep a userland call might come in and has this variable raised. I don't know why it enforces not to be in interrupt context, maybe because of the long delays required to take an abort. But in this case it triggers wrong. In the meantime it should be safe not to check the intr_context part. -- B.Walter BWCT http://www.bwct.de bernd@bwct.de info@bwct.de
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050402103624.GS2072>