On Tue, 16 Jul 2013, Clemens Ladisch wrote: > Alan Stern wrote: > > The audio-out stream uses a pipeline of only 2 URBs. The URBs start > > out alternating between 8 and 7 packets apiece. This yields a total > > latency around 1.9 ms (equivalent to 2 periods of about 41 frames at > > 44.1 KHz), which is smaller than I would expect (2 periods of 64 frames > > works out to 2.9 ms). > > > > Anyway, this sort of works. Every so often (roughly at intervals of 15 > > ms) there is an underrun. Evidently the computer's EHCI hardware > > sometimes requires URBs to be submitted more than 7 microframes in > > advance. > > It would be trivial to make the driver respect these constraints, if > only there were some mechanism to know about them. That's a very good point. We ought to have some way of exporting that information from the HCDs, but we don't. I can tell you this much, if it helps: For high-speed devices on EHCI, maintaining a minimum pipeline length of 9 microframes should be sufficient under normal circumstances. There were a few examples in James's trace where 8 was too short. (xHCI may have lesser requirements for high-speed devices; I don't know what they are. For that matter, some EHCI controllers also may have lesser requirements, but since we can't export the actual value it would be best to stick with a 9-uframe minimum.) For full-speed devices, I think the minimum pipeline length can be as low as 1 frame. This is the same as saying that there should be more than one URB total, so it's not much of a restriction. Note that by "minimum pipeline length", I mean the smallest duration of URBs in the queue at any time. The minimum occurs when one of the largest URBs completes (it is not considered to be in the queue until it gets resubmitted). For example, a pipeline of three URBs with lengths 8, 8, and 4 packets should work quite well. It would have a minimum pipeline length of 12 microframes (when one of the 8-packet URBs was completing). But 8, 4, and 4 would not be good. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html