linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Suwan Kim <suwan.kim027@gmail.com>
To: Mathias Nyman <mathias.nyman@linux.intel.com>
Cc: linux-usb@vger.kernel.org
Subject: usb: xhci: Support running urb giveback in tasklet context
Date: Fri, 1 Mar 2019 18:08:51 +0900	[thread overview]
Message-ID: <20190301090850.GA2797@localhost.localdomain> (raw)

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

             reply	other threads:[~2019-03-01  9:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-01  9:08 Suwan Kim [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-03-01  9:54 usb: xhci: Support running urb giveback in tasklet context Suwan Kim
2019-03-01  9:15 Suwan Kim
2019-02-28  9:18 Mathias Nyman
2019-02-19 15:41 Suwan Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190301090850.GA2797@localhost.localdomain \
    --to=suwan.kim027@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).