Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp758404ybg; Wed, 23 Oct 2019 05:33:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpgJzqw41EtMzp4DQGK4O/NlW3YwVQH7JaQxueLMteCVeARC6no6U8S3SYpRIfPhhGDyu9 X-Received: by 2002:aa7:d852:: with SMTP id f18mr10710187eds.110.1571834018118; Wed, 23 Oct 2019 05:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571834018; cv=none; d=google.com; s=arc-20160816; b=X6IlOqOhq2e8Po1DkeFFxitwXUgXh4+uQk1gcXOeptocFOtbi3mFTjPMViuzjM7SOg TYTU61F5aUvHHtqXKgayVU+3e5vHADfMaF4p+fPgusk4NsJ0W4VblPu8KT//kJgbWFip XsGW+rg0lLxn/BowxCKgXvqePiy+o/JQqQxx1wNSplyjmUvN0cdA2JAG/VXYCIZ/DNoo LwFoMbxOvX/2KucA6QvFYq7nTMx6RSSljvp6Edoi1Adch5kThLhLbzPpT5HOreEtTCdE UrDNcv+4mRem99AYY4FH0V/E7YcpqeGlzaPp4EMq7Nyr7Hx7NOEuWRWxIW8vnAQr9nZk lNBA== 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=xeGHhIazHjbmXETf2LAZnyOId7SvzhgwolMgMV8mqgI=; b=QcKQ155xtf43DqxLjQWCb+qcuhE+3PCJvP9K0RbXRiiyzLo2eM8gmrbmrp3gOI6h8x tNdhyi1kfCG3A4O64dm3WDdD++ULIhQ6lmXJG/yxZlY1bVGwnm/kzdyaJBaBLLndl7u5 drDtprpuA5yqgP1zKyhUq3tPqjWVauK+deBBpHQVvH7NmetpBqE6A8wJXkdU2Oa3wM+6 ucXX4I19QcXvRfK2kIdhCmO3GQVLUAyOxWP62hjf4NQFTrFI4m8Kbzcvn+S6Qp14KA9v bZTRarrK9Jvj3snPIpGbk+XOYniFKA/r+QjgW6rezgY6LbxJXjr45fRNSNWBqCu4VwkR pzow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ao4VWypj; 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 d24si2606425eda.162.2019.10.23.05.33.14; Wed, 23 Oct 2019 05:33:38 -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=ao4VWypj; 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 S2390124AbfJWIMn (ORCPT + 99 others); Wed, 23 Oct 2019 04:12:43 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:36393 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727574AbfJWIMn (ORCPT ); Wed, 23 Oct 2019 04:12:43 -0400 Received: by mail-io1-f68.google.com with SMTP id c16so3983441ioc.3; Wed, 23 Oct 2019 01:12:42 -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=xeGHhIazHjbmXETf2LAZnyOId7SvzhgwolMgMV8mqgI=; b=ao4VWypjOJKTjbSco/Rm0FE9dAVuyvq1d6PKfUiUCaqYYvJdFIV+fbDUolBd0PRsbY pkkJ+Oebiwc6SkqJJUo/ElWVHbqdEgNaneOk9yP24LfDqzlt+kv/uo2Z76zaKQfeC32J er0fwJOHwdNj7ON2ZzqxTv+uq2UUMTuO1LFMw52psE/wyKzJxxj/vOinljG51ZHACOwv LVQAiLSIWoCMwimKQiE6s+N1jspEyaepbD2taKipH4mR46QZk5dxNkHA7ZrGBKT7Vhq2 ktSpXPouo3LVBo41+UjrEnk968zAW3qfzv0PWsBldQ5yMdbR1ZyqMaW+oRANIytf1Bzq hGGg== 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=xeGHhIazHjbmXETf2LAZnyOId7SvzhgwolMgMV8mqgI=; b=oOjgESWnAGvPx3XV2rjUDyeXVaodDRFIZ+CDQ+UOe9ApYWk55zJinh8ULSNpF9s5KY Cv7EdASvjL7xvDq2Bavp15o///FytvVX6Jq5XL27TSfQmTXA88OzL8Rxo5OEr9xJxEKV GypG884g/Hb/yCFgGbY72w2LM9nY5nSEU/MY5J3VEFq6kOTmTQdwdAhSh7+LV0TqBW1W fO4aTZhM62ArS0ox9RRNvCsX64Vqs0s71zL5EkvEbFWS0cA7y+cHDpRLAa4UaNI6j6tG gprsYduoYFMDbmXsBYZyjGI5dNOGfRoguSulhZPGT/rI0jnodbYUSTFDghTBdzTaCST5 aevA== X-Gm-Message-State: APjAAAUSk4brjqCuNRft05/BPamimDuTL/hWQJVRXtkF9xgIZ4kOgV1j JJFOUaiPHn14EpR27Uwf/GaXBYuMYaA3sxmRgoKJCeli X-Received: by 2002:a5e:9e0a:: with SMTP id i10mr2022517ioq.172.1571818361783; Wed, 23 Oct 2019 01:12:41 -0700 (PDT) MIME-Version: 1.0 References: <20190403185310.8437-1-matwey@sai.msu.ru> <20190614164554.27679-1-matwey@sai.msu.ru> <20190702173335.GA2724@uda0271908> In-Reply-To: From: "Matwey V. Kornilov" Date: Wed, 23 Oct 2019 11:12:29 +0300 Message-ID: Subject: Re: [PATCH v2 0/6] musb: Improve performance for hub-attached webcams To: Bin Liu Cc: Greg KH , Alan Stern , "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 =D0=BF=D0=BD, 9 =D1=81=D0=B5=D0=BD=D1=82. 2019 =D0=B3. =D0=B2 19:33, Matwey= V. Kornilov : > > =D0=B2=D1=82, 2 =D0=B8=D1=8E=D0=BB. 2019 =D0=B3. =D0=B2 20:33, Bin Liu : > > > > Matwey, > > > > On Tue, Jul 02, 2019 at 08:29:03PM +0300, Matwey V. Kornilov wrote: > > > Ping? > > > > I was offline and just got back. I will review it soon. Sorry for the > > delay. > > Ping? > Ping? > > > > -Bin. > > > > > > > > =D0=BF=D1=82, 14 =D0=B8=D1=8E=D0=BD. 2019 =D0=B3. =D0=B2 19:47, Matwe= y V. Kornilov : > > > > > > > > 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 transmiss= ion 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 > > > > -- > With best regards, > Matwey V. Kornilov --=20 With best regards, Matwey V. Kornilov