Re: [RFC] usb: dwc2: hcd: fix split schedule issue

From: Alan Stern
Date: Sat Nov 14 2015 - 12:32:39 EST


On Fri, 13 Nov 2015, Doug Anderson wrote:

> To handle things smarter, I think I need to research how to deal with
> hubs attached to hubs attached to hubs. For instance:
>
> dwc2
> -> multi_tt hub
> -> single_tt hub
> -> device 1
> -> device 2
> -> single_tt hub
> -> device 3
> -> device 4
> vs.
>
> dwc2
> -> single_tt hub
> -> multi_tt hub
> -> device 1
> -> device 2
> -> multi_tt hub
> -> device 3
> -> device 4
>
> In the first case I presume I could schedule device 1 and device 3 at
> the same time, but not device 2 and device 4.

Devices 2 and 4 are related in exactly the same way as 1 and 3. You
can schedule them independently. But you can't schedule 1
independently of 2 or 3 independently of 4.

> In the 2nd case I
> presume I could schedule all 4 devices independently. ...but I
> haven't dug through the spec to confirm that, yet.

That's right. The basic rule is very simple: Independent scheduling
requires that the devices in question be attached through different
TTs, where a multi-TT hub has a separate TT for each port.

On the other hand, it's important to keep in mind that even though you
can consider the devices independently as far as scheduling on the
FS/LS buses is concerned, you also have to consider the bandwidth
requirements of the SSPLIT and CSPLIT packets on the HS bus. Since
there's only one HS bus, those things can't be independent.

How do you decide which microframes to dedicate to a particular
endpoint? The scheduler in ehci-hcd isn't especially sophisticated
about this, and it can easily work itself into a corner by allocating
things in such a way that there's no microframe to put a new request
even though the total amount of available bandwidth is more than
sufficient. I have put a lot of thought into ways of improving this,
but there doesn't seem to be any good approach that doesn't require
rebalancing (i.e., changing the microframes allocated to certain
endpoints) from time to time. Rebalancing is very awkward because it
means stopping some ongoing transfers temporarily, removing the entries
from their old scheduled positions, putting them into the new
positions, and then restarting the transfers. It can't be done
transparently or quickly.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/