Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751736AbbKNRc0 (ORCPT ); Sat, 14 Nov 2015 12:32:26 -0500 Received: from netrider.rowland.org ([192.131.102.5]:40745 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751327AbbKNRcX (ORCPT ); Sat, 14 Nov 2015 12:32:23 -0500 Date: Sat, 14 Nov 2015 12:32:22 -0500 (EST) From: Alan Stern X-X-Sender: stern@netrider.rowland.org To: Doug Anderson cc: John Youn , Yunzhi Li , Julius Werner , Dinh Nguyen , "Kaukab, Yousaf" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , wulf , Kever Yang , caesar , Tao Huang , rockchip-discuss Subject: Re: [RFC] usb: dwc2: hcd: fix split schedule issue In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2564 Lines: 66 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/