Re: Poor performance with USB 1.1 drive connected to USB 3.0 port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 30 Sep 2014 14:10:28 +0800
"Lu, Baolu" <baolu.lu@xxxxxxxxxxxxxxx> wrote:

> I tried to reproduce this issue. I connected a USB key under a 
> full-speed hub.
> 
> sg_rbuf returns error which I am not familiar with.
> 
> allen@allen-ivb:~$ lsusb -t
> [...snip...]
> /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/3p, 480M
>      |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
>          |__ Port 4: Dev 11, If 0, Class=Hub, Driver=hub/3p, 12M
>              |__ Port 1: Dev 12, If 0, Class=Human Interface Device, 
> Driver=usbhid, 12M
>              |__ Port 1: Dev 12, If 1, Class=Human Interface Device, 
> Driver=usbhid, 12M
>              |__ Port 3: Dev 15, If 0, Class=Mass Storage, 
> Driver=usb-storage, 12M
> 
> allen@allen-ivb:~$ sudo dd if=/dev/zero of=/dev/sdb bs=4k count=1k
> 1024+0 records in
> 1024+0 records out
> 4194304 bytes (4.2 MB) copied, 4.32676 s, 969 kB/s
> 
> allen@allen-ivb:~$ sudo sg_rbuf --buffer=524288 -q -t -v /dev/sg2
>      Read buffer cdb: 3c 03 00 00 00 00 00 00 04 00
> READ BUFFER descriptor error: SCSI status: Check Condition
>   Fixed format, current;  Sense key: Illegal Request
>   Additional sense: Invalid command operation code

You won't be able to use sg_rbuf. sg_rbuf issues READ BUFFER commands,
which most/all USB sticks won't support. Using dd instead should be fine to
show the problem.

In the USB tree you posted, the hub is connected to a USB 2.0 port and the
969KB/sec dd result looks reasonable. Now try with the USB 1.1 hub
connected to a USB 3.0 port.

For my testing, I increased the maximum USB transfer size using a command
like
  echo 1024 >/sys/block/sdb/device/max_sectors
[By default the kernel limits transfers to 120KB (240 512-byte sectors),
presumably because some devices break with larger ones. Changing that
shouldn't be necessary to show the problem though.]

If you want to bypass the block layer, you could use ddpt instead of dd; see
  http://sg.danny.cz/sg/ddpt.html

ddpt can issue SCSI commands directly, so you could do something like
  ddpt if=/dev/sdb of=/dev/null bs=512 bpt=240 count=65536 verbose=2 iflag=pt
to time reading the first 32MB.


Mark
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux