Re: Low performance of g_mass_storage virtual usb device

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

 



Hello, thanks for the answer. Maybe I sound stupid but how can I tell
g_mass_storage which controller to use? If I unload dummy_hcd and then
try to modprobe g_mass_storage I get an error "no such device".

# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 003: ID 046d:c050 Logitech, Inc. RX 250 Optical Mouse
Bus 002 Device 004: ID 046d:c31d Logitech, Inc.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

Thanks in advance.

--
Victor

On Thu, Sep 5, 2013 at 5:58 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> On Thu, 5 Sep 2013, Victor Leschuk wrote:
>
>> Hello all,
>>
>> I have recently faced a performance problem with usb gadget emulated
>> USB flash drive. It is working fine except for very low performance.
>>
>> I use a 4Gb file, created by dd and created a ext2 or vfat (tried
>> both) partition on it. Than I mount it using the following command
>> sequence:
>>
>> ------------------------------
>> # modprobe dummy_hcd is_super_speed=1 # I tried is_high_speed=1, and
>> no parameter too
>> # modprobe g_mass_storage file=/home/del/img/flash stall=0 # tried w/o
>> stall=0 too
>> # mount /dev/sdc1 /mnt/tmp
>> ------------------------------
>>
>> After that I get /dev/sdc and /dev/sdc1 devices created without any
>> errors in dmesg:
>>
>> ------------------------------
>> [1256700.986581] usb 3-1: reset high-speed USB device number 5 using dummy_hcd
>> [1256701.022551]  gadget: high-speed config #1: Linux File-Backed Storage
>> [1256701.242481] usb 3-1: reset high-speed USB device number 5 using dummy_hcd
>> [1256701.278422]  gadget: high-speed config #1: Linux File-Backed Storage
>> [1256701.422339]  gadget: high-speed config #1: Linux File-Backed Storage
>> [1256934.915697] usb 3-1: reset high-speed USB device number 5 using dummy_hcd
>> [1256934.951628]  gadget: high-speed config #1: Linux File-Backed Storage
>> [1256935.915155] usb 3-1: reset high-speed USB device number 5 using dummy_hcd
>> [1256935.951090]  gadget: high-speed config #1: Linux File-Backed Storage
>> [1256936.095018]  gadget: high-speed config #1: Linux File-Backed Storage
>> [1317073.396892] usb-storage 3-1:1.0: Quirks match for vid 0525 pid a4a5: 10000
>> [1317073.396995] scsi53 : usb-storage 3-1:1.0
>> [1317074.411883] scsi 53:0:0:0: Direct-Access     Linux    File-CD
>> Gadget   0302 PQ: 0 ANSI: 2
>> [1317074.412669] sd 53:0:0:0: Attached scsi generic sg3 type 0
>> [1317074.431910] sd 53:0:0:0: [sdc] 8388608 512-byte logical blocks:
>> (4.29 GB/4.00 GiB)
>> [1317074.443816] sd 53:0:0:0: [sdc] Write Protect is off
>> [1317074.443821] sd 53:0:0:0: [sdc] Mode Sense: 0f 00 00 00
>> [1317074.455839] sd 53:0:0:0: [sdc] Write cache: enabled, read cache:
>> enabled, doesn't support DPO or FUA
>> [1317074.551757]  sdc: sdc1
>> [1317074.683704] sd 53:0:0:0: [sdc] Attached SCSI removable disk
>> ------------------------------
>>
>> The problem is that IO performance is very poor. Writing 200Mb file
>> takes quite a while:
>>
>> ------------------------------
>> $ ls -lh file
>> -rw-rw-r-- 1 root del 206M Sep  4 09:34 file
>> $ time sudo cp file /mnt/tmp/
>> real    11m59.618s
>> user    0m0.000s
>> sys     0m0.260s
>> ------------------------------
>>
>>
>> Which is about 300K/sec. However the same file on the same system is
>> copied to a real USB flash in less than a minute. Looks like it is
>> emulating a USB 1.1 controller, not USB 2.0...
>>
>> iotop shows something like this:
>>
>> ------------------------------
>>  TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND
>>  9986 be/4 root        0.00 B/s  262.05 K/s  0.00 % 99.86 % cp file /mnt/tmp/
>> 20651 be/4 root       51.77 K/s  238.95 K/s  0.00 % 93.23 % [file-storage]
>> ------------------------------
>>
>> Can anything be done to improve the performance of
>> g_mass_storage-emulated USB drive?
>>
>> PS: I am using kernel
>>
>> ------------------------------
>> $ uname -rm
>> 3.2.0-4-686-pae i686
>> ------------------------------
>>
>> Thanks in advance.
>
> This has nothing to do with g_mass_storage.
>
> What you are seeing is low performance of dummy-hcd.  dummy-hcd depends
> strongly on the timer setting; it won't really work properly unless you
> have CONFIG_HZ set to 1000.  In general, the performance of dummy-hcd
> doesn't matter because it is meant only for testing.
>
> If you use g_mass_storage with a real USB device controller, you should
> find that it performs much better.
>
> Alan Stern
>
--
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