Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6217453rwi; Tue, 18 Oct 2022 09:28:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM50lDJyU8wk6v1NGu1qKmx2LmHaQmnuuGS5G/+g5vWLH/Ace8CAieMcZbxwqQ0pDhpw6ukX X-Received: by 2002:a17:906:99c5:b0:73d:70c5:1a4f with SMTP id s5-20020a17090699c500b0073d70c51a4fmr3005003ejn.302.1666110514108; Tue, 18 Oct 2022 09:28:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666110514; cv=none; d=google.com; s=arc-20160816; b=i0ma5IvlMvRin5/vluQGh2IdR0epkqxKrF1torilar80gD1O/dmhLLjeG9wzB3/dwP Uo82bTNCPP/6xchFCLvmZK+3oXIRqYKlvxrqtV+KVkAk83UtB0QAJYxHm0cd//+SNkJJ 8Ybf4bwPq8H+6sU5mNjRrV6tfwWv2n2vmrw/gBbUXZHfpRP1Ye0VhGkRHccMrSn3bkqq w7gT7fD5Goj5GbgMhW5IdP+ceJTBOxSJMDrtVsIHYsKfzPPJpmi7Yn+Xt+Zj5XHKL3dQ eGW3bhEx5Ou4u79E2Zf+u2/s453cYmGVg+LcoQoTg+isMQXnOoi5kjwI8Jqul7isfdgx jcJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0F8o+F4tnhQnHHGEaCv7rKARcrXRixnf8ejRwj2t2Xk=; b=ZN3Aq2hiVU35CLpNR52ZMKf3a72bvX3FKGP/hOJcqfKvutcr626wyMuPvRT56IgE6s oN+VAjdXe0ei57Dk1UF83Q5YAqDR6loaUvjAN72ikgsNFIDtGXR4RhJLk6NJP1xmVmGJ +Q7Zscpdg+4CPPeMp4+4fsmlD/XrrJ/5KxnXZyNjeZt7EGKzXi1BaNz6OPyTzDFNlmZ0 DOwn7cLurcRc7ar+A/fb1V+7FibTtGZTslOSHgP7IcmadiJYE9fhua0MAX1kzoJMkZR4 TjW012PeQMEet2gVHOwRfCUqxusb13WXjGdP91UkkpdQCPHis0Xtcpti2a3GYqvnV02c oPHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@motorola.com header.s=Selector header.b=j6oKOVx6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=motorola.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rn5-20020a170906d92500b007801a579899si10093785ejb.448.2022.10.18.09.28.07; Tue, 18 Oct 2022 09:28:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@motorola.com header.s=Selector header.b=j6oKOVx6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=motorola.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229584AbiJRPPF (ORCPT + 99 others); Tue, 18 Oct 2022 11:15:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230182AbiJRPPB (ORCPT ); Tue, 18 Oct 2022 11:15:01 -0400 Received: from mail1.bemta33.messagelabs.com (mail1.bemta33.messagelabs.com [67.219.247.4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B07CE62A88; Tue, 18 Oct 2022 08:14:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=motorola.com; s=Selector; t=1666106097; i=@motorola.com; bh=0F8o+F4tnhQnHHGEaCv7rKARcrXRixnf8ejRwj2t2Xk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=j6oKOVx64izCW0RXO0F6FrB5ZO7QggIsEkC7P643/PGnfEEGByh/1OKCvfrwLWnMx DO/u8Mpfn7912TvfuLD30HJhdlQQEFU5aMWQ9EQ1AmsQXKF6+7wKDAhzgUY9wTu9aL OwaH8OPvUAOHP3u+U8YQbNXn2mzs6ZrKGE/ZI8G396b0rtORDXhlVvUsXtAsN1Ehda gqDiuwzFMlVnPgIhXWlIwTPoyFAi/oE6fqT5rljyS8N01+5Y28g9qus+VSGxQeJfCH vhQGlQQUOkLY7KDuALvNK3Jcwwx1sX3WrfHHVi8Njsio0cYdLQ0JgWl7v0Vf5bED5m JAjXla3Tpaf/g== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmplleJIrShJLcpLzFFi42LJePFEVPfDIb9 kgxvrBS2OtT1ht3hyoJ3RonfZHjaL5sXr2Sw6Jy5ht1jYtoTF4vKuOWwWi5a1MltsabvCZPHj Tx+zxYTfF9gsVi04wO7A4zG7Yyarx6ZVnWwe++euYfdY3DeZ1aP/r4HH7Ls/GD227P/M6PF5k 1wARxRrZl5SfkUCa8b8JveC37IV67fdY29gfCnexcjFISQwnUni6qxvjBDOMiaJi89fsHcxcn KwCKhKnH68mxHEZhNQk1jwehUziC0ioCWxueklM0gDs8BtZomnv66zgCSEBQIlnj34CtbAK6A sseLyVKipJxkllnxfwAKREJQ4OfMJmM0MNOnGv5dMXYwcQLa0xPJ/HCBhTgFjiUkrTjFNYOSd haRjFpKOWQgdCxiZVzGaFacWlaUW6Roa6iUVZaZnlOQmZuboJVbpJuqVFuumJhaX6BrpJZYX6 6UWF+sVV+Ym56To5aWWbGIExkhKkfuBHYw/lv3RO8QoycGkJMpbsdMvWYgvKT+lMiOxOCO+qD QntfgQowwHh5IE77/9QDnBotT01Iq0zBxgvMKkJTh4lER4v2wCSvMWFyTmFmemQ6ROMepyTJ3 9bz+zEEtefl6qlDivMDD6hQRAijJK8+BGwFLHJUZZKWFeRgYGBiGegtSi3MwSVPlXjOIcjErC vDv3AU3hycwrgdv0CugIJqAjTLeAHVGSiJCSamDS/MjRl7TC2kaEre5G/K6N6xv9XB8rt4oUx oQqay/Z+lHn4MsKj8TDv5Wl/13/K7XlF3+7/ezZ/y5ULosIOn2YY5vAyo/1PrvlE6ez1RR628 RZS5er56/cEf+kWtNl2uKGmpzvq2bPUHybfX9azL6c29OCzRQV3B9d9XVhTr+9Z9tPlXPnTL/ 3Xb3McmDO52xVK2OV8yJ1IbWTN+Xu/KQS4PPxTRmjvurhGMeH9ecr5kT/+6pRtWrh8dUm6x6c 33FkzoMG6XJDDmcl+ZuavW+NzsSfj9zFOid6M/u1ZJOvlk+ju9Y/vmWeGJu302OZ21sjvudJJ 80ZXxT66UicYl4WfUvRdam452q5+h2nrx1WYinOSDTUYi4qTgQAAZjG7pgDAAA= X-Env-Sender: w36195@motorola.com X-Msg-Ref: server-10.tower-715.messagelabs.com!1666106095!24726!1 X-Originating-IP: [104.232.228.21] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.100.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 17868 invoked from network); 18 Oct 2022 15:14:56 -0000 Received: from unknown (HELO va32lpfpp01.lenovo.com) (104.232.228.21) by server-10.tower-715.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 18 Oct 2022 15:14:56 -0000 Received: from va32lmmrp02.lenovo.com (va32lmmrp02.mot.com [10.62.176.191]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by va32lpfpp01.lenovo.com (Postfix) with ESMTPS id 4MsHTq6YGbzf6md; Tue, 18 Oct 2022 15:14:55 +0000 (UTC) Received: from p1g3 (unknown [100.64.172.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: w36195) by va32lmmrp02.lenovo.com (Postfix) with ESMTPSA id 4MsHTq4qFzzf6WS; Tue, 18 Oct 2022 15:14:55 +0000 (UTC) Date: Tue, 18 Oct 2022 10:14:54 -0500 From: Dan Vacura To: Alan Stern Cc: Dan Scally , linux-usb@vger.kernel.org, Thinh Nguyen , Jeff Vanhoof , Greg Kroah-Hartman , Jonathan Corbet , Laurent Pinchart , Felipe Balbi , Michael Grzeschik , Paul Elder , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: Re: [PATCH v3 6/6] usb: gadget: uvc: add configfs option for sg support Message-ID: References: <20221017205446.523796-1-w36195@motorola.com> <20221017205446.523796-7-w36195@motorola.com> <78c6403a-22d9-903d-f0cf-4205e17962d3@ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alan, On Tue, Oct 18, 2022 at 10:32:33AM -0400, Alan Stern wrote: > On Tue, Oct 18, 2022 at 02:27:13PM +0100, Dan Scally wrote: > > Hi Dan > > > > On 17/10/2022 21:54, Dan Vacura wrote: > > > The scatter gather support doesn't appear to work well with some UDC hw. > > > Add the ability to turn on the feature depending on the controller in > > > use. > > > > > > Signed-off-by: Dan Vacura > > > > > > Nitpick: I would call it use_sg everywhere, but either way: > > > > > > Reviewed-by: Daniel Scally > > > > Tested-by: Daniel Scally > > > > > --- > > > V1 -> V2: > > > - no change, new patch in serie > > > V2 -> V3: > > > - default on, same as baseline > > > > > > Documentation/ABI/testing/configfs-usb-gadget-uvc | 1 + > > > Documentation/usb/gadget-testing.rst | 2 ++ > > > drivers/usb/gadget/function/f_uvc.c | 2 ++ > > > drivers/usb/gadget/function/u_uvc.h | 1 + > > > drivers/usb/gadget/function/uvc_configfs.c | 2 ++ > > > drivers/usb/gadget/function/uvc_queue.c | 4 ++-- > > > 6 files changed, 10 insertions(+), 2 deletions(-) > > > > > > diff --git a/Documentation/ABI/testing/configfs-usb-gadget-uvc b/Documentation/ABI/testing/configfs-usb-gadget-uvc > > > index 5dfaa3f7f6a4..839a75fc28ee 100644 > > > --- a/Documentation/ABI/testing/configfs-usb-gadget-uvc > > > +++ b/Documentation/ABI/testing/configfs-usb-gadget-uvc > > > @@ -9,6 +9,7 @@ Description: UVC function directory > > > streaming_interval 1..16 > > > function_name string [32] > > > req_int_skip_div unsigned int > > > + sg_supported 0..1 > > > =================== ============================= > > > What: /config/usb-gadget/gadget/functions/uvc.name/control > > > diff --git a/Documentation/usb/gadget-testing.rst b/Documentation/usb/gadget-testing.rst > > > index f9b5a09be1f4..8e3072d6a590 100644 > > > --- a/Documentation/usb/gadget-testing.rst > > > +++ b/Documentation/usb/gadget-testing.rst > > > @@ -796,6 +796,8 @@ The uvc function provides these attributes in its function directory: > > > function_name name of the interface > > > req_int_skip_div divisor of total requests to aid in calculating > > > interrupt frequency, 0 indicates all interrupt > > > + sg_supported allow for scatter gather to be used if the UDC > > > + hw supports it > > Why is a configuration option needed for this? Why not always use SG > when the UDC supports it? Or at least, make the decision automatically > (say, based on the amount of data to be transferred) with no need for > any user input? Patches for a fix and to select to use SG depending on amount of data are already submitted and under review. I agree, ideally we don't need this patch, but there have been several regressions uncovered with enabling this support and it takes time to root cause these issues. In my specific environment, Android GKI 2.0, changes need to get upstreamed first here before they're pulled into Android device software. Having this logic in place gives us the ability to turn off this functionality without going through this process. A revert was also considered until all the bugs are resolved, but the code is quite entrenched now to take out, plus others seem to benefit from it being enabled. Thus the configurability. > > Is this because the SG support in some UDC drivers is buggy? In that > case the proper approach is to fix the UDC drivers, not add new options > that users won't know when to use. > > Or is it because the UDC hardware itself is buggy? In that case the > best approach is to fix the UDC drivers so that they don't advertise > working SG support when the hardware is unable to handle it. > > Alan Stern