public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Takashi Iwai <tiwai@suse.de>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH] media: uvcvideo: Fix spurious DMA max segment size warnings
Date: Fri, 10 Jun 2022 10:57:40 +0200	[thread overview]
Message-ID: <YqMHhPXPGkTcXICd@kroah.com> (raw)
In-Reply-To: <YqG65hU4SLUrxMI7@pendragon.ideasonboard.com>

On Thu, Jun 09, 2022 at 12:18:30PM +0300, Laurent Pinchart wrote:
> Hi Takashi,
> 
> (CC'ing Greg and the linux-usb mailing list)
> 
> Thank you for the patch.
> 
> On Thu, Jun 09, 2022 at 10:22:46AM +0200, Takashi Iwai wrote:
> > As default, the DMA max segment size is set to 64k, and uvcvideo may
> > overflow that size easily, resulting in a warning like:
> > 
> >   DMA-API: xhci_hcd 0000:00:14.0: mapping sg segment longer than device claims to support [len=98304] [max=65536]
> > 
> > Explicitly set up the DMA max segment size for avoiding spurious kernel
> > warnings.
> > 
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > ---
> >  drivers/media/usb/uvc/uvc_video.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
> > index 1b4cc934109e..25aa6e6a6906 100644
> > --- a/drivers/media/usb/uvc/uvc_video.c
> > +++ b/drivers/media/usb/uvc/uvc_video.c
> > @@ -2160,6 +2160,8 @@ int uvc_video_init(struct uvc_streaming *stream)
> >  	for_each_uvc_urb(uvc_urb, stream)
> >  		INIT_WORK(&uvc_urb->work, uvc_video_copy_data_work);
> >  
> > +	dma_set_max_seg_size(uvc_stream_to_dmadev(stream), UINT_MAX);
> > +
> 
> uvc_stream_to_dmadev() returns the pointer to the HCD's struct device,
> which is shared between all drivers on the bus. Is it really fine for a
> USB device driver to change the maximum segment size of the HCD device
> directly ?

Ick, no!  That feels wrong, it should only change things for that one
specific device, not all devices on that bus.

thanks,

greg k-h

  reply	other threads:[~2022-06-10  8:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09  8:22 [PATCH] media: uvcvideo: Fix spurious DMA max segment size warnings Takashi Iwai
2022-06-09  9:18 ` Laurent Pinchart
2022-06-10  8:57   ` Greg Kroah-Hartman [this message]
2022-06-10 11:13     ` Takashi Iwai

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=YqMHhPXPGkTcXICd@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=tiwai@suse.de \
    /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