All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Doug Anderson <dianders@chromium.org>
Cc: Lukas Wunner <lukas@wunner.de>,
	Minas Harutyunyan <minas.harutyunyan@synopsys.com>,
	Stefan Wahren <stefan.wahren@i2se.com>,
	Jisheng Zhang <Jisheng.Zhang@synaptics.com>,
	Woojung Huh <woojung.huh@microchip.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-rpi-kernel@lists.infradead.org" 
	<linux-rpi-kernel@lists.infradead.org>,
	Alexandru M Stan <amstan@chromium.org>
Subject: Re: lan78xx: About 8000 usb interrupts per second when idle
Date: Mon, 15 Apr 2019 14:15:47 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1904151410090.1575-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <CAD=FV=Wbt-g0QtWQ2KzmWsXRygCk6=mJ6xYrnbL6E_NAUY6QkA@mail.gmail.com>

On Mon, 15 Apr 2019, Doug Anderson wrote:

> Hi,
> 
> On Sun, Apr 14, 2019 at 12:46 PM Lukas Wunner <lukas@wunner.de> wrote:
> >
> > On Tue, Apr 09, 2019 at 09:28:16AM +0000, Minas Harutyunyan wrote:
> > > Am 09.04.19 um 08:54 schrieb Jisheng Zhang:
> > > > The second one: 8000 usb interrupts per second when idle.
> > > > This is abnormal. any idea? Is it due to the lan78xx?
> > >
> > > dwc2 in host mode enable SOF interrupts if any periodic EP are in use.
> > > So, 8000 interrupts per second is expectant behavior.
> >
> > The dwc_otg driver patched into the Raspberry Pi Foundation's
> > kernel seems to make do with much fewer interrupts and much
> > lower CPU load.  How does it do that and how could dwc2 be
> > made to do the same?  Would it be possible for you to provide
> > me with documentation on the chip?  The Synopsis website
> > requires registration for downloads and registration requires
> > a Synopsis customer ID.
> >
> > It seems the Foundation's dwc_otg driver was forked from code
> > that later begat dwc2.
> 
> Your information might be misleading.  The downstream dwc2 driver for
> Raspberry PI handles the SoF interrupts at FIQ (fast interrupt) time.
> The idea here is that this is to prioritize it above all other things
> in the system since FIQ can fire even if we're currently in another
> interrupt handler.
> 
> IIRC:
> 
> * FIQs don't get counted in /proc/interrupts.  So probably you really
> are getting 8000 FIQs per second still, you just don't know it.
> 
> * FIQs don't count towards CPU load calculations, so it looks like the
> CPU is less loaded by this than it really is.  I have no evidence
> here, but I seem to remember someone telling me this, so if you
> believe this is wrong then ignore it.
> 
> 
> That all being said, though the purpose of using the FIQ is to improve
> the latency of handling SoF interrupts, it is also plausible that when
> it was written it also had the side effect of making the code more
> efficient.  I mean, there's theoretically maybe some built-in
> efficiency by skipping all the Linux interrupt infrastructure, but I'd
> bet that's not a huge deal and a bigger deal is how inefficient the
> mainline dwc2 driver is at handling interrupts.  I doubt you'd manage
> to get FIQ support for something like this on mainline, but you could
> possible spend more time improving the efficiency of the interrupt
> handler.  I spent some time on this a while ago but it was just small
> things--I didn't gut it and re-think how to make it faster.
> 
> 
> Note also that I spent a bit of time a few years ago making the
> upstream dwc2 driver more robust despite some of its inefficiencies.
> In the end it was fairly robust, though if you wanted to do something
> like audio or USB webcams with it you'd still struggle without higher
> CPU speeds or patches like <https://crbug.com/820961>.  I'm still of
> the belief that, unless the downstream driver has ported over the
> uFrame work I did, that the upstream dwc2 driver will be compatible
> with more more combinations of devices/hubs than the downstream one.

I can confirm that the upstream dwc2 driver has fixed some bugs that
are (or were at the time) present in dwc_otg.  It was years ago and I
don't remember the details, but one of the problems involved
communication with a full-speed device.  Possibly isochronous
transfers; I'm not sure.  The transfers were failing, and a USB bus
analyzer showed that the reason was an invalid byte sequence sent by
the Raspberry Pi while using dwc_otg.  dwc2 sent the correct sequence.

I don't know how much development work is currently going into dwc_otg, 
but I suspect it's a lot less than the amount of work being put into 
dwc2.

Alan Stern


  reply	other threads:[~2019-04-15 18:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190408143443.335f7e93@xhacker.debian>
     [not found] ` <002929b7-9a0d-6d92-4e03-18a6748c6708@i2se.com>
     [not found]   ` <20190408160551.03911b27@xhacker.debian>
     [not found]     ` <20190409144655.753d3bd9@xhacker.debian>
2019-04-09  7:18       ` lan78xx: About 8000 usb interrupts per second when idle Stefan Wahren
2019-04-09  9:28         ` Minas Harutyunyan
2019-04-10  9:37           ` Jisheng Zhang
2019-04-10 10:08             ` Oliver Neukum
2019-04-14 19:46           ` Lukas Wunner
2019-04-15  0:53             ` Woojung.Huh
2019-04-15 17:35             ` Doug Anderson
2019-04-15 18:15               ` Alan Stern [this message]
2019-04-14 21:51 Paul Zimmerman

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=Pine.LNX.4.44L0.1904151410090.1575-100000@iolanthe.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=Jisheng.Zhang@synaptics.com \
    --cc=amstan@chromium.org \
    --cc=dianders@chromium.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=minas.harutyunyan@synopsys.com \
    --cc=stefan.wahren@i2se.com \
    --cc=woojung.huh@microchip.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.