From: Peter Chen <hzpeterchen@gmail.com>
To: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: "Linux USB" <linux-usb@vger.kernel.org>,
"David Miller" <davem@davemloft.net>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: u_ether: remove interrupt throttling
Date: Wed, 2 Nov 2016 16:36:32 +0800 [thread overview]
Message-ID: <20161102083632.GA22181@b29397-desktop> (raw)
In-Reply-To: <87vaw6nwn3.fsf@linux.intel.com>
On Wed, Nov 02, 2016 at 09:55:44AM +0200, Felipe Balbi wrote:
>
> Hi,
>
> Peter Chen <hzpeterchen@gmail.com> writes:
> > On Tue, Nov 01, 2016 at 01:29:59PM +0200, Felipe Balbi wrote:
> >> According to Dave Miller "the networking stack has a
> >> hard requirement that all SKBs which are transmitted
> >> must have their completion signalled in a fininte
> >> amount of time. This is because, until the SKB is
> >> freed by the driver, it holds onto socket,
> >> netfilter, and other subsystem resources."
> >>
> >> In summary, this means that using TX IRQ throttling
> >> for the networking gadgets is, at least, complex and
> >> we should avoid it for the time being.
> >>
> >> Cc: <stable@vger.kernel.org>
> >> Reported-by: Ville Syrj�l� <ville.syrjala@linux.intel.com>
> >> Suggested-by: David Miller <davem@davemloft.net>
> >> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
> >> ---
> >> drivers/usb/gadget/function/u_ether.c | 8 --------
> >> 1 file changed, 8 deletions(-)
> >>
> >> diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c
> >> index f4a640216913..119a2e5848e8 100644
> >> --- a/drivers/usb/gadget/function/u_ether.c
> >> +++ b/drivers/usb/gadget/function/u_ether.c
> >> @@ -589,14 +589,6 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
> >>
> >> req->length = length;
> >>
> >> - /* throttle high/super speed IRQ rate back slightly */
> >> - if (gadget_is_dualspeed(dev->gadget))
> >> - req->no_interrupt = (((dev->gadget->speed == USB_SPEED_HIGH ||
> >> - dev->gadget->speed == USB_SPEED_SUPER)) &&
> >> - !list_empty(&dev->tx_reqs))
> >> - ? ((atomic_read(&dev->tx_qlen) % dev->qmult) != 0)
> >> - : 0;
> >> -
> >> retval = usb_ep_queue(in, req, GFP_ATOMIC);
> >> switch (retval) {
> >> default:
> >> --
> >
> > Felipe, it may increase cpu utilization since more interrupts will be there,
> > it may affect the SoC which has lower cpu frequency. This code existed
> > many years, why this problem has only reported at dwc3 recently?
>
> No idea, but at least for networking gadgets we shouldn't throttle. This
> has been a bug since the beginning. Read Dave Miller's explanation at
> [1]
>
> moreover, dwc3 seems to be the only one actually throttling IRQ. Here's
> a rundown of a few of the UDCs:
>
> - chipidea: uses TD_IOC conditionally, but always sets TD_TERMINATE
>
> lastnode->ptr->next = cpu_to_le32(TD_TERMINATE);
> if (!hwreq->req.no_interrupt)
> lastnode->ptr->token |= cpu_to_le32(TD_IOC);
>
> I'm guessing TD_TERMINATE works similar to dwc3's LST bit. If
> it's set, it will force an interrupt.
No, TD_TERMINATE just stands for it is the last TD, and this pointer will
be updated when the new request is added. The interrupt is only triggered
by IOC (Interrupt On Complete) bit at TD.
I am not sure if dwc3 supports ITC (Interrupt Threshold Control)
software control, it is an EHCI compliant register entry, and
the device mode is supported for chipidea too. It is a timeout
mechanism from controller side for pending requests.
The interrupt will be triggered either the request has completed for TD
which IOC bit is set or the ITC is fired (125us currently) and the
request has completed, so the problem David described should not exist,
at least for chipidea.
If DWC3 has similar ITC bits, would you try to tune it? The default ITC
value for chipidea is not enough, and we tuned it before.
>
> - musb: no_interrupt only used for tracing
>
> - atmel_usba_udc: no_interrupt only used for tracing
>
> - mv_u3d_core: probably throttles interrupt, but probably exhibits same
> behavior. It's just that it hasn't been reported.
>
> - fsl_udc_core: probably throttles interrupt, but probably exhibits same
> behavior. It's just that it hasn't been reported.
The above two uses chipidea IP core too.
--
Best Regards,
Peter Chen
next prev parent reply other threads:[~2016-11-02 8:36 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-01 11:29 [PATCH] usb: gadget: u_ether: remove interrupt throttling Felipe Balbi
2016-11-01 12:21 ` Ville Syrjälä
2016-11-02 6:02 ` Peter Chen
2016-11-02 7:55 ` Felipe Balbi
2016-11-02 8:36 ` Peter Chen [this message]
2016-11-02 11:02 ` Felipe Balbi
2016-11-03 0:32 ` Peter Chen
2016-11-03 8:36 ` Felipe Balbi
2016-11-02 15:22 ` David Miller
2016-11-03 0:23 ` Peter Chen
2016-11-03 7:04 ` Felipe Balbi
2016-11-03 9:03 ` Peter Chen
2016-11-03 9:53 ` Peter Chen
2016-11-03 10:48 ` Felipe Balbi
2016-11-04 2:11 ` Peter Chen
2016-11-07 12:36 ` Felipe Balbi
2016-11-08 1:42 ` Peter Chen
2016-11-03 10:42 ` Felipe Balbi
2016-11-04 1:12 ` Peter Chen
2016-11-04 1:14 ` Peter Chen
2016-11-03 17:04 ` David Miller
2016-11-07 12:39 ` Felipe Balbi
2016-11-07 15:50 ` David Miller
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=20161102083632.GA22181@b29397-desktop \
--to=hzpeterchen@gmail.com \
--cc=davem@davemloft.net \
--cc=felipe.balbi@linux.intel.com \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=ville.syrjala@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).