All of lore.kernel.org
 help / color / mirror / Atom feed
* Bug: VHCI + USB 3.0
@ 2019-04-05 19:19 Bollinger, Seth
  2019-04-05 21:01 ` Alan Stern
  0 siblings, 1 reply; 33+ messages in thread
From: Bollinger, Seth @ 2019-04-05 19:19 UTC (permalink / raw)
  To: linux-usb; +Cc: Bollinger, Seth

Hello All,

We recently have run into a problem using a USB 3.0 thumb drive over USBIP where the driver will unlink URBs when trying to mount a FAT partition.  This happens because of the remote XHCI controller returning errno 75 during IN URB processing.  I've traced the failure to the following steps:

1. usb-storage sends a SCSI READ_10 request OUT URB to vhci
2. vhci forwards to remote workstation over USBIP and submits the URB
3. usb-storage sends a 32K IN URB using a SG table
4. usb_sg_init notices that vhci bus doesn't support SG (usb/core/message.c:399)
5. usb_sg_init breaks the SG table into an URB for each SG entry (usb/core/message.c:418)
6. vhci forwards to remote and submits the URBs
7. XHCI processes the first URB, but the buffer is too small to contain the bulk of the data and sets errno -75 when it would overflow the URB buffer (xhci-ring.c:2371)

It appears to me when the SG read is broken into multiple URBs, the latency in processing the remote URBs is causing XHCI to fail the IN.  A similar error sometimes occurs on OUTs as well.  I apologize, but I don't remember the errno off the top of my head for the OUT.

I patched usb_sg_init to alloc/free a contiguous URB so as not to fragment INS/OUTS and this is working well so far.

1. Does that seem like the correct fix?
2. Is this fix something the community would be interested in?

I'm open to working on a more "correct" patch if prompted to do so (as long as we're not talking weeks of work...).

Thanks,

Seth

^ permalink raw reply	[flat|nested] 33+ messages in thread
* Bug: VHCI + USB 3.0
@ 2019-04-12 18:01 ` Alan Stern
  0 siblings, 0 replies; 33+ messages in thread
From: Alan Stern @ 2019-04-12 18:01 UTC (permalink / raw)
  To: Bollinger, Seth; +Cc: USB list

On Wed, 10 Apr 2019, Alan Stern wrote:

> On Wed, 10 Apr 2019, Bollinger, Seth wrote:
> 
> > > On Apr 9, 2019, at 2:13 PM, Bollinger, Seth <Seth.Bollinger@digi.com<mailto:Seth.Bollinger@digi.com>> wrote:
> > >
> > > > Seth, you can try adding:
> > > >
> > > >  blk_queue_virt_boundary(sdev->request_queue, 1024 - 1)
> > > >
> > > > in drivers/usb/storage/scsiglue.c:slave_alloc(), just after the call to
> > > > blk_queue_update_dma_alignment().  Perhaps that will help
> > > >
> > >
> > > I will do that as a test.  However, I’m concerned that we’re solving only a specific case.  Won’t it fail in a similar way if a different subsystem does the same thing (USB modem or > video drivers, etc.)?
> > 
> > Just to follow up, this does seem to solve the specific problem.
> 
> Great!  Okay, here's an actual patch for you to try.  I have removed 
> the blk_queue_update_dma_alignment() call because it doesn't seem to 
> be necessary.  The starting location of each scatterlist element is 
> unimportant; only the length matters.
> 
> If this works, I will submit it as a bugfix for the kernel.

Any more test results?  I need to know that you're confident the patch 
works okay.

Alan Stern

PS: I changed my mind and decided to keep the
blk_queue_update_dma_alignment() call.  It probably doesn't hurt (the
data buffers are most likely already aligned) and some host controllers
may have alignment requirements.

^ permalink raw reply	[flat|nested] 33+ messages in thread
* Bug: VHCI + USB 3.0
@ 2019-04-13 11:37 ` Bollinger, Seth
  0 siblings, 0 replies; 33+ messages in thread
From: Bollinger, Seth @ 2019-04-13 11:37 UTC (permalink / raw)
  To: Alan Stern; +Cc: USB list

> On Apr 12, 2019, at 1:01 PM, Alan Stern <stern@rowland.harvard.edu<mailto:stern@rowland.harvard.edu>> wrote:
>
> Any more test results?  I need to know that you're confident the patch
> works okay

The patch didn’t apply for me.  I figured a copy paste problem, so I made the changes by hand.

Your changes fix my problem.

If it’s not too much to ask, please send me a message if you find patches that fix similar issues with SG and vhci.  :)  I’m sure we’ll run into those problems if they exist.

> Alan Stern
>
> PS: I changed my mind and decided to keep the
> blk_queue_update_dma_alignment() call.  It probably doesn't hurt (the
> data buffers are most likely already aligned) and some host controllers
> may have alignment requirements.

Ok, I’ll add that call back.

Thanks!

Seth

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2019-04-13 11:38 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-05 19:19 Bug: VHCI + USB 3.0 Bollinger, Seth
2019-04-05 21:01 ` Alan Stern
2019-04-05 21:30   ` Bollinger, Seth
2019-04-06 15:34     ` Alan Stern
2019-04-06 15:57       ` Bollinger, Seth
2019-04-06 16:08         ` Alan Stern
2019-04-08 12:39           ` Bollinger, Seth
2019-04-08 14:33             ` Alan Stern
2019-04-08 14:48               ` Bollinger, Seth
2019-04-08 16:29               ` Bollinger, Seth
2019-04-08 17:23                 ` Alan Stern
2019-04-08 18:28                   ` Bollinger, Seth
2019-04-08 18:59                     ` Alan Stern
2019-04-08 19:12                       ` Bollinger, Seth
2019-04-08 19:50                         ` Alan Stern
2019-04-09 13:30                         ` Bollinger, Seth
2019-04-09 14:51                           ` Bollinger, Seth
2019-04-09 13:30                         ` Bollinger, Seth
2019-04-09 15:19                           ` Alan Stern
2019-04-09 15:56                             ` Ming Lei
2019-04-09 19:06                               ` Alan Stern
2019-04-09 19:13                                 ` Bollinger, Seth
2019-04-09 19:57                                   ` Alan Stern
2019-04-10  8:02                                     ` Oliver Neukum
2019-04-10 14:22                                       ` Alan Stern
2019-04-10 13:50                                   ` Bollinger, Seth
2019-04-10 14:52                                     ` Alan Stern
2019-04-10 14:52                                       ` Alan Stern
2019-04-08 18:39                   ` Bollinger, Seth
2019-04-12 18:01 Alan Stern
2019-04-12 18:01 ` Alan Stern
2019-04-13 11:37 Bollinger, Seth
2019-04-13 11:37 ` Bollinger, Seth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.