On Wed, 23 Aug 2017, David Mosberger wrote: > On Tue, Aug 22, 2017 at 3:40 PM, Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote: > > On Tue, Aug 22, 2017 at 02:44:20PM -0600, David Mosberger wrote: > > >> > There was an option a while ago to turn USB irqs > >> > into threaded irqs, do those work on your platform? If so, that might > >> > help you out here. > >> > >> Do you mean this: > >> > >> https://lkml.org/lkml/2008/10/20/465 > >> > >> or is there something else/newer? > > > > I think there was something newer than that almost-a-decade-old thread, > > but I don't remember. Look at what the RT kernel patch does, it might > > be in there if it wasn't merged into the tree already. > > Actually, I'm not able to find much in this direction. > Do you have something more specific I could be looking for? > > I don't think the RT patches would (readily) work for my case as I have > a (soft-)realtime interrupt handler that depends on other drivers (e.g,. > SPI and DMA). > > Looking at the OHCI and EHCI drivers more carefully, even if those > were turned into threaded handlers, the problem would not > (automatically) go away since they implicitly (OHCI) or explicitly (EHCI) > disable (local) interrupt delivery while processing the URBs (in particular, > while giving them back, which can trigger a lot of extra work). I was going to point out something along these lines. Even if the majority of the work gets done in a threaded handler, that doesn't help much if the threaded handler runs with interrupts disabled. However, your understanding is not entirely correct. When ehci-hcd gives back an URB, the USB core handles it in a tasklet -- not in the context used by ehci-hcd. The tasklet runs with interrupts enabled for at least part of the time. (In theory it could run with interrupts enabled almost all of the time, but it was not deemed practical to do this because USB drivers were originally written with the understanding that their URB-completion handlers would be called with interrupts disabled, and auditing all of them was too difficult.) The same is not true for ohci-hcd, but in principle the driver could be changed to act the same as ehci-hcd. This was not considered a high priority because ohci-hcd only handles USB-1.1 connections, which are considerably slower than USB-2. > I'd very much appreciate any pointers to any work or thought that > might have gone into improving this situation (in particular: returning > URBs with interrupts enabled). The USB stack disabling > interrupts for such extended periods of time surely isn't a problem just > in my situation. As far as I know, nobody has complained about it before you. See commit 94dfd7edfd5c ("USB: HCD: support giveback of URB in tasklet context"). Implementing this in ehci-hcd required some non-trivial changes. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html