Ping? пт, 14 июн. 2019 г. в 19:47, Matwey V. Kornilov <matwey@xxxxxxxxxx>: > > The series is concerned to issues with isochronous transfer while > streaming the USB webcam data. I discovered the issue first time > when attached PWC USB webcam to AM335x-based BeagleBone Black SBC. > It appeared that the root issue was in numerous missed IN requests > during isochronous transfer where each missing leaded to the frame > drop. Since every IN request is triggered in MUSB driver > individually, it is important to queue the send IN request as > earlier as possible when the previous IN completed. At the same > time the URB giveback handler of the device driver has also to be > called there, that leads to arbitrarily delay depending on the > device driver performance. The details with the references are > described in [1]. > > The issue has two parts: > > 1) peripheral driver URB callback performance > 2) MUSB host driver performance > > It appeared that the first part is related to the wrong memory > allocation strategy in the most USB webcam drivers. Non-cached > memory is used in assumption that coherent DMA memory leads to > the better performance than non-coherent memory in conjunction with > the proper synchronization. Yet the assumption might be valid for > x86 platforms some time ago, the issue was fixed for PWC driver in: > > 1161db6776bd ("media: usb: pwc: Don't use coherent DMA buffers for ISO transfer") > > that leads to 3.5x performance gain. The more generic fix for this > common issue are coming for the rest drivers [2]. > > The patch allowed successfully running full-speed USB PWC webcams > attached directly to BeagleBone Black USB port. > > However, the second part of the issue is still present for > peripheral device attached through the high-speed USB hub due to > its 125us frame time. The patch series is intended to reorganize > musb_advance_schedule() to allow host to send IN request quicker. > > The patch series is organized as the following. First three patches > improve readability of the existing code in > musb_advance_schedule(). Patches 4 and 5 introduce updated > signature for musb_start_urb(). The last patch introduce new > code-path in musb_advance_schedule() which allows for faster > response. > > References: > > [1] https://www.spinics.net/lists/linux-usb/msg165735.html > [2] https://www.spinics.net/lists/linux-media/msg144279.html > > Changes since v1: > - Patch 6 was redone to keep URB giveback order and stop transmission at > erroneous URB. > > Matwey V. Kornilov (6): > usb: musb: Use USB_DIR_IN when calling musb_advance_schedule() > usb: musb: Introduce musb_qh_empty() helper function > usb: musb: Introduce musb_qh_free() helper function > usb: musb: Rename musb_start_urb() to musb_start_next_urb() > usb: musb: Introduce musb_start_urb() > usb: musb: Decrease URB starting latency in musb_advance_schedule() > > drivers/usb/musb/musb_host.c | 132 ++++++++++++++++++++++++++++--------------- > drivers/usb/musb/musb_host.h | 1 + > 2 files changed, 86 insertions(+), 47 deletions(-) > > -- > 2.16.4 > -- With best regards, Matwey V. Kornilov