Re: [RFC PATCH] usb: hcd: complete URBs in threaded-IRQ context instead of tasklet
From: Alan Stern
Date: Fri Feb 16 2018 - 16:46:48 EST
On Fri, 16 Feb 2018, Sebastian Andrzej Siewior wrote:
> On 2018-02-16 13:29:01 [-0500], Alan Stern wrote:
> > We originally used tasklets because we didn't want to incur the delays
> > associated with running in a process context. It seems odd to be
> > reversing that decision now.
>
> The theaded interrupt runs SCHED_FIFO priority 50 by default. The only
> thing that can interrupt it are interrupts, a softirq (not ksoftirqd)
> and other tasks with a higher priority than 50.
> There should be no downside performance wise.
Maybe. It would be nice to see some real measurements.
> > > The URBs from the root-hub never create an interrupt so I currently
> > > process them in a workqueue (I'm not sure if an URB-enqueue in the
> > > completion handler would break something).
> >
> > It worked okay before we changed over to using tasklets.
>
> Ah okay. I've seen that HCDs were no longer dropping their internal lock
> and I wasn't sure if such a change was also applied in RH-code.
Oh... my memory was faulty. After going back and looking at the old
source, I see that before we switched to tasklets the code _did_ drop
the hcd_root_hub_lock when giving back root-hub URBs. Now it doesn't.
(It's also worth noticing that the current code gives back root-hub
URBs in a tasklet even for HCDs that don't support using tasklets for
non-root-hub URBs.)
In any case, latency doesn't matter much for root-hub URBs.
Alan Stern