linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Vacura <w36195@motorola.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Dan Scally <dan.scally@ideasonboard.com>,
	linux-usb@vger.kernel.org,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Jeff Vanhoof <qjv001@motorola.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Felipe Balbi <balbi@kernel.org>,
	Michael Grzeschik <m.grzeschik@pengutronix.de>,
	Paul Elder <paul.elder@ideasonboard.com>,
	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
Date: Tue, 18 Oct 2022 10:14:54 -0500	[thread overview]
Message-ID: <Y07C7hYKyByahNjL@p1g3> (raw)
In-Reply-To: <Y065ASuFhM9bntvd@rowland.harvard.edu>

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 <w36195@motorola.com>
> > 
> > 
> > Nitpick: I would call it use_sg everywhere, but either way:
> > 
> > 
> > Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
> > 
> > Tested-by: Daniel Scally <dan.scally@ideasonboard.com>
> > 
> > > ---
> > > 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

  reply	other threads:[~2022-10-18 15:15 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-17 20:54 [PATCH v3 0/6] uvc gadget performance issues Dan Vacura
2022-10-17 20:54 ` [PATCH] usb: gadget: uvc: fix dropped frame after missed isoc Dan Vacura
2022-10-18  1:50   ` Bagas Sanjaya
2022-10-18  2:15     ` Dan Vacura
2022-10-18  5:13       ` Greg Kroah-Hartman
2022-10-17 20:54 ` [PATCH v3 2/6] usb: dwc3: gadget: cancel requests instead of release " Dan Vacura
2022-10-17 21:30   ` Thinh Nguyen
2022-10-18  2:10     ` Dan Vacura
2022-10-18 18:45       ` Thinh Nguyen
2022-10-18 19:13         ` Michael Grzeschik
2022-10-18 22:45           ` Thinh Nguyen
2022-10-19  6:46             ` Michael Grzeschik
2024-02-22  0:02   ` Michael Grzeschik
2024-02-22  1:20     ` Thinh Nguyen
2024-02-27 21:01       ` Michael Grzeschik
2024-03-07  1:57         ` Thinh Nguyen
2024-03-07 16:15           ` Michael Grzeschik
2024-03-08  2:47             ` Thinh Nguyen
2022-10-17 20:54 ` [PATCH v3 3/6] usb: gadget: uvc: fix sg handling in error case Dan Vacura
2022-10-17 20:54 ` [PATCH v3 4/6] usb: gadget: uvc: fix sg handling during video encode Dan Vacura
2022-10-17 20:54 ` [PATCH v3 5/6] usb: gadget: uvc: make interrupt skip logic configurable Dan Vacura
2022-10-17 20:54 ` [PATCH v3 6/6] usb: gadget: uvc: add configfs option for sg support Dan Vacura
2022-10-18 13:27   ` Dan Scally
2022-10-18 14:04     ` Michael Grzeschik
2022-10-18 14:09       ` Dan Scally
2022-10-18 14:10       ` Dan Scally
2022-10-18 15:00         ` Dan Vacura
2022-10-18 14:32     ` Alan Stern
2022-10-18 15:14       ` Dan Vacura [this message]
2022-10-18 15:23         ` Alan Stern
2022-10-18 15:28         ` Michael Grzeschik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y07C7hYKyByahNjL@p1g3 \
    --to=w36195@motorola.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=balbi@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dan.scally@ideasonboard.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.grzeschik@pengutronix.de \
    --cc=paul.elder@ideasonboard.com \
    --cc=qjv001@motorola.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).