Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3614632ybi; Tue, 2 Jul 2019 10:30:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwBS3vXlCv82j2aWT97nkp0/U6Jsl4/s0icqP3NO6Jvi6C7XsZPcfqkHy3kpLnSr0P6lOUJ X-Received: by 2002:a63:c4:: with SMTP id 187mr18638575pga.272.1562088634356; Tue, 02 Jul 2019 10:30:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562088634; cv=none; d=google.com; s=arc-20160816; b=C5Dbnd8EqhPdJN5oYye++WarNgMd+1Afqq7cWhb6RpbEDG7lt8tJdEwI8OUnxRaUYX lVIpTCpLOpqo0CjeWumKpvb6dnVkpGsnntG52SEV1RcCCxtJKCF1U2CnLoD3/MEroA15 +tlKlG/S1Q1vzpgYyOR7ZSYjZqeJg0YBTo4wBLRwC1QbJ+JqD4/v/JldQYhTb1nrwPdp iaBCacHPj/+m4JvCVkEf3/BpuRkrXCCU+/uBxYmWUPeRSqvhvQBY933Lk00UQxmfP5Ut u+ercOfAyNMnld71FSO/7a2wpdTvdBFYOWMdsc4LaFkMUIVg4VnEz3a45RBOYE+4hOmh +Osg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=b/VodJHchTtPTwJ7u4UXy48B+Jx4LeRpv6rlLSWJCYs=; b=gmPxFJpOovo98UfTujApuk0r3gBm2l5NcbCaD9hG9l9qKKl85TOL0qf21PETjOYdss IL+DNGFvwdqYzO+hK6ACpuXjFbEnlDKJr8h/NCBzmAS3iakgX/97+RZ73ApPxB1U5KBG dBrcPHoXjVfLMIlgL2VBqoidb7fjGDYITzgv6eKfcXfpqT2i71A0t+hHk2cS748bPc96 m92CzUbKv0kS2xl/2U03CO6eIpUnQ1lty2QsxFYIzpxIi9l/oMbPPd5XoK1ak19LgdTA WvDE928yf2vSjeAUvy5YxwK2vsI11f0z3jYTsm6ipZy5jG4sKhDEiXnREJyl+wIaBVRv kyBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZIUrlL36; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l71si6835216pgd.314.2019.07.02.10.30.19; Tue, 02 Jul 2019 10:30:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZIUrlL36; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727050AbfGBR3R (ORCPT + 99 others); Tue, 2 Jul 2019 13:29:17 -0400 Received: from mail-oi1-f194.google.com ([209.85.167.194]:44062 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726193AbfGBR3Q (ORCPT ); Tue, 2 Jul 2019 13:29:16 -0400 Received: by mail-oi1-f194.google.com with SMTP id e189so13691227oib.11; Tue, 02 Jul 2019 10:29:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=b/VodJHchTtPTwJ7u4UXy48B+Jx4LeRpv6rlLSWJCYs=; b=ZIUrlL36rqsKjgHMotePAaXOU0MvxKbBHXwPN/4ciNOhSG3YChe11HDdUYn3GZahP8 Up+ppoUl8UIW9nT4/wRcmwcVjWd6J74V1/lAKyqVJQw8azl4HyJZdMkb0R+bafevLra3 GSfaD6SUApZOucM/FRc78bSdTICUV88Wyb4UILbmzSTp1t/xpQ+LOGmjUEqlxPTRGksR YaFDFT86xpeI7DQameuTPO0XRxltmG9gGnnAmBAAVh5Di0mo1MK1cHDrEoguz1KVRIpm Iy7HNz7sbUX4Q/4L/ykJOfvOg/vko2LwWKiKGSj//bpX9QTWi2cmTB5O67srnV4Ufw8+ B+dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=b/VodJHchTtPTwJ7u4UXy48B+Jx4LeRpv6rlLSWJCYs=; b=ogf9eCC7i/dEAmLF/YM0kr7FsrhqhUs66QX5HhdylcBmAF5jtkk/rtmh0asV57/Ak9 UNR70FXdUdCAx0PIVi5m0UlB48r9eduZSxTmt6v6rGpsEP/x9vFkD+RcRu1luKvMQfR4 1svbX1mfL3odOcjIHtegC6yxR5GqmbM/rb4RYF1PwD2hmRPehK2E3mhArPfFazY8CThS cTeKE9je52pEsW8unwOD8SKaXm69AKZbAK1V/7Z8I/byQSBGPFrtmQEp72m/8Zd0y4vd NMnKVEdWBVJqFvCqdJZS4Mlnyr8X+FVQmnjKifPjGXenOYzG++93m2VrLJlHLFNJSKB1 5Rww== X-Gm-Message-State: APjAAAXYtzeI2wl4G/g0C4tPU18dItDjVcjSf52Sm4tmXq8xVBBSW1QR /sp2B9BjWUMDtROTLQ7AeBhjOVFy7Rm6SwcHy7c= X-Received: by 2002:aca:e4c9:: with SMTP id b192mr3795893oih.82.1562088555714; Tue, 02 Jul 2019 10:29:15 -0700 (PDT) MIME-Version: 1.0 References: <20190403185310.8437-1-matwey@sai.msu.ru> <20190614164554.27679-1-matwey@sai.msu.ru> In-Reply-To: <20190614164554.27679-1-matwey@sai.msu.ru> From: "Matwey V. Kornilov" Date: Tue, 2 Jul 2019 20:29:03 +0300 Message-ID: Subject: Re: [PATCH v2 0/6] musb: Improve performance for hub-attached webcams To: Bin Liu , Greg KH , Alan Stern Cc: "open list:MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER" , open list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ping? =D0=BF=D1=82, 14 =D0=B8=D1=8E=D0=BD. 2019 =D0=B3. =D0=B2 19:47, Matwey V. K= ornilov : > > 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 IS= O 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 > --=20 With best regards, Matwey V. Kornilov