Hi Mathias, On Thu, Feb 28, 2019 at 11:18:58AM +0200, Mathias Nyman wrote: > Hi > > On 19.2.2019 17.41, Suwan Kim wrote: > > Patch "USB: HCD: support giveback of URB in tasklet context" > > introduced giveback of urb in tasklet context. [1] This patch was > > applied to ehci but not xhci. [2] It significantly reduces the hard > > irq time of xhci. Especially for the uvc driver, the hard irq including > > the uvc complete function runs quite long (about 300-350us in my > > Thinkpad s440 laptop with webcam) but applying this patch reduces > > the hard irq time of xhci to about 18-30us. > > Sorry about the late reply. > Can you recall any reason why this wasn't applied to xhci back then? Ming Lei who is the author of the giveback-tasklet patch in usb core worked with Alan stern when he was working on the patch, and he only replaced giveback of ehci. I don't know why he didn't replace xhci. After some time, somebody asked him why this patch did not apply to xhci. And there was no apparent reason.[1] IMO, no one seems interested in xhci... > xhci is doing a lot in hard interrupt context, and reducing that would > be a good idea. Another option to look at is using threaded interrupts > for xhci. When the giveback-tasklet patch was working, the author experimented with comparing threaded interrupt and tasklet. At that time, tasklet showed better performance than threaded interrupt.[2] > We might however be opening a can of worms with this, the impact is unknown. > > How much testing was done with URB return in tasklet for SS devices? > > Would be nice to test this out on a bit wider audience before applying it. Unfortunately, SS devices I have are only usb mass storage devices. When I tested with a USB mass storage device, both xhci with tasklet and without tasklet(urb complete in hard IRQ) showed similar performance. [USB-mass storage TEST] - Testbed is i5-7600 and two mass storage devices (usb flash memory, external hard drive) are used. Test is executed 10 times and figure out the average speed - dd if=/dev/sdN of=/dev/null iflag=direct bs=1G count=1 - device1 : Sandisk Ultra Flair USB 3.0 32GB - device2 : WD My Passport 2TB (external hard drive) - xhci without tasklet - device1 - 129.727MB/s - device2 - 103.667MB/s - xhci with tasklet - device1 - 103.2MB/s - device2 - 103.692MB/s I have only one high-speed isochronous type device that is built-in webcam in my laptop (Thinkpad s440, i5-4210U) In this case, it is difficult to measure the performance. So i checked the overrun/underrun event in xhci. Until now, no overrun/underrun event has occurred in actual use. Regards Suwan Kim