hi there,

i think the usb subsystem is in certain circumstances
starving the writes...

i have this great working sandisk "ultra backup" 32G
usb key, that was consistently achieving ~10MB/s
in writing big files (movies).  in windows, it can
pack even 15MB/s.

now i have this:

$ time dd if=1.mp4 of=/mnt/1.mp4 bs=1m
268+0 records in
267+0 records out
279969792 bytes transferred in 401.012 secs (698156 bytes/sec)
295+0 records in
294+0 records out
308281344 bytes transferred in 440.531 secs (699795 bytes/sec)
620+1 records in
620+1 records out
650617965 bytes transferred in 949.335 secs (685340 bytes/sec)
      950.23 real         0.01 user         5.59 sys

first i thought, this might be some file system issue
(fat32).  but i tried this is:

$ sudo dd if=/dev/zero of=/dev/rsd3a bs=1m count=300
300+0 records in
300+0 records out
314572800 bytes transferred in 42.414 secs (7416611 bytes/sec)

some might say ~7.5MB/s is not bad, but
please note: this is RAW, sequential write from
/dev/zero.  it should be higher.


creating the file system takes _very_ long time:

$ sudo fdisk -i /dev/rsd3c
Do you wish to write new MBR and partition table? [n] y
Writing MBR at offset 0.

$ sudo disklabel -E sd3
Label editor (enter '?' for help at any prompt)
> a
partition: [a] 
offset: [64] 
size: [62557046] 
FS type: [4.2BSD] 
Rounding size to bsize (32 sectors): 62557024
> w
> q
No label changes.

$ sudo time newfs /dev/rsd3a 
/dev/rsd3a: 30545.4MB in 62557024 sectors of 512 bytes
151 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
super-block backups (for fsck -b #) at:
 32, 414688, 829344, 1244000, 1658656, 2073312, 2487968, 2902624, 3317280, 
3731936, 4146592, 4561248,
 4975904, 5390560, 5805216, 6219872, 6634528, 7049184, 7463840, 7878496, 
8293152, 8707808, 9122464, 9537120,
 9951776, 10366432, 10781088, 11195744, 11610400, 12025056, 12439712, 12854368, 
13269024, 13683680, 14098336,
 14512992, 14927648, 15342304, 15756960, 16171616, 16586272, 17000928, 
17415584, 17830240, 18244896,
 18659552, 19074208, 19488864, 19903520, 20318176, 20732832, 21147488, 
21562144, 21976800, 22391456,
 22806112, 23220768, 23635424, 24050080, 24464736, 24879392, 25294048, 
25708704, 26123360, 26538016,
 26952672, 27367328, 27781984, 28196640, 28611296, 29025952, 29440608, 
29855264, 30269920, 30684576,
 31099232, 31513888, 31928544, 32343200, 32757856, 33172512, 33587168, 
34001824, 34416480, 34831136,
 35245792, 35660448, 36075104, 36489760, 36904416, 37319072, 37733728, 
38148384, 38563040, 38977696,
 39392352, 39807008, 40221664, 40636320, 41050976, 41465632, 41880288, 
42294944, 42709600, 43124256,
 43538912, 43953568, 44368224, 44782880, 45197536, 45612192, 46026848, 
46441504, 46856160, 47270816,
 47685472, 48100128, 48514784, 48929440, 49344096, 49758752, 50173408, 
50588064, 51002720, 51417376,
 51832032, 52246688, 52661344, 53076000, 53490656, 53905312, 54319968, 
54734624, 55149280, 55563936,
 55978592, 56393248, 56807904, 57222560, 57637216, 58051872, 58466528, 
58881184, 59295840, 59710496,
 60125152, 60539808, 60954464, 61369120, 61783776, 62198432,
      848.35 real         3.11 user         5.36 sys

that's 14 minutes for a 32G file system :-(

iostat sheds a bit of light, when i start copying
the same file on ffs (similar on fat32):

$ iostat -w1 sd3
      tty              sd3             cpu
 tin tout  KB/t  t/s  MB/s  us ni sy in id
   5  103 55.49    2  0.12   2  0  2  0 95
   1  509  0.00    0  0.00   1  0  0  0 99
   1  115  0.00    0  0.00   0  0  0  1 99
  14  114  0.00    0  0.00   1  0  0  0 99
   4  718  0.00    0  0.00   1  0  1  0 98
   4  232 11.00    3  0.03   1  0  0  0 99
   1   44 16.00   44  0.68   0  0  0  1 99
   6   44 16.00   43  0.67   0  0  0  0100
  13   43 16.00   42  0.66   0  0  0  2 98
   5 1309 16.00   43  0.67   1  0  1  0 98
   0  119 16.00    8  0.12   0  0  0  1 99
   0  120 16.00   44  0.69   0  0  0  1 99
   0  119 16.00   43  0.67   0  0  0  1 99
   0  118 16.00   43  0.67   0  0  1  0 99
   0  119 16.00   43  0.67   1  0  0  0 99
   0  119 16.00   44  0.68   0  0  0  0100
   0  119 16.00   46  0.71   0  0  0  0100
   0  119 16.00   21  0.32   0  0  0  0100
   0  119 32.50    2  0.06   0  0  0  0100
   0  121 64.00    1  0.06   0  0  1  0 99

it seems every write operation is capped at 700KB/s...
notice how it gets starved even on that.

to check that the usb port is not busted, i have tried other
usb keys (cheaper and slower) and paradoxically they worked
better, here is pushing the same file to softraid encrypted
sandisk "cruzer fit" 32G (sd3):

      tty              sd0               sd1               sd2               
sd3             cpu
 tin tout  KB/t  t/s  MB/s   KB/t  t/s  MB/s   KB/t  t/s  MB/s   KB/t  t/s  
MB/s  us ni sy in id
   0  291 64.00   64  4.00   0.00    0  0.00  16.00  213  3.33  16.00  213  
3.33   0  0 17  9 74
   0  703 61.18   17  1.00   0.00    0  0.00  16.00  119  1.85  16.00  119  
1.85   1  0 14  4 81
   0  291 63.33   48  2.97   0.00    0  0.00  16.00  190  2.97  16.00  190  
2.97   0  0 14  7 79
   0  472 64.00   31  1.96   0.00    0  0.00  16.00  121  1.88  16.00  121  
1.88   1  0  8  7 84
   0  288 64.00   48  2.97   0.00    0  0.00  16.00  168  2.63  16.00  168  
2.63   1  0 19 10 70
   0  290 64.00   32  2.00   0.00    0  0.00  16.00  171  2.67  16.00  171  
2.67   0  0 14  8 78
   0  287 64.00   32  1.98   0.00    0  0.00  16.00  101  1.58  16.00  101  
1.58   3  0  9  1 87
   0  293 62.08   51  3.06   0.00    0  0.00  16.00  206  3.22  16.00  206  
3.22   1  0 20  8 71
   0  478 64.00   32  1.98   0.00    0  0.00  16.00  108  1.69  16.00  108  
1.69   0  0  8  6 86


the behaviour is also not consistent.
with the ultra backup, i can reproduce this ~700KB cap
every time, also after reboot, also in any of the 3 usb
ports of the notebook (however i can copy on it in
windows on another notebook ~15 MB/s and it worked
faster on this same notebook before).  with the other
keys, sometimes they are really slow (200KB/s),
sometimes their speeds start out "healthy" and they
start to stutter, sometimes they stay healthy.

many people have usb keys, so i thought, if there
is write starvation, other people should have noticed also.
is anybody else seeing somethig like this?

ps. while i have no "hard data" statictics on my transfer
speeds, so they are "perceived", i use these keys daily
with rsync and mc and they both show estimated speeds
(also i have gkrellm open).  maybe these speeds are not
correct, however relatively speaking they still have
plummetted..



here is the usb keys dmesg:

umass1 at uhub0 port 2 configuration 1 interface 0 "SanDisk Ultra Backup" rev 
2.00/2.00 addr 5
umass1: using SCSI over Bulk-Only
scsibus4 at umass1: 2 targets, initiator 0
sd2 at scsibus4 targ 1 lun 0: <SanDisk, Ultra Backup, 8.32> SCSI0 0/direct 
removable serial.07815535330F5BE0CACB
sd2: 30547MB, 512 bytes/sector, 62562239 sectors


OpenBSD 5.4-current (GENERIC.MP) #80: Sun Oct 13 17:46:03 MDT 2013
    [email protected]:/usr/src/sys/arch/i386/compile/GENERIC.MP
cpu0: Intel(R) Atom(TM) CPU N570 @ 1.66GHz ("GenuineIntel" 686-class) 1.67 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,NXE,LONG,SSE3,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE,LAHF,PERF
real mem  = 1061818368 (1012MB)
avail mem = 1032691712 (984MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 03/31/10, SMBIOS rev. 2.6 @ 0xeb0f0 (53 
entries)
bios0: vendor LENOVO version "50CN12WW" date 04/22/2011
bios0: LENOVO 20109
acpi0 at bios0: rev 3
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP APIC MCFG SLIC HPET
acpi0: wakeup devices P0P8(S4) PS2K(S3) PS2M(S3) EUSB(S3) P0PA(S4) P0PB(S4) 
P0PC(S4) P0P9(S3) USB0(S3) USB1(S3) USB2(S3) USB3(S3) PWRB(S3) SLPB(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: apic clock running at 166MHz
cpu0: mwait min=64, max=64, C-substates=0.2.2.0.2, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Atom(TM) CPU N570 @ 1.66GHz ("GenuineIntel" 686-class) 1.67 GHz
cpu1: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,NXE,LONG,SSE3,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE,LAHF,PERF
cpu2 at mainbus0: apid 2 (application processor)
cpu2: Intel(R) Atom(TM) CPU N570 @ 1.66GHz ("GenuineIntel" 686-class) 1.67 GHz
cpu2: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,NXE,LONG,SSE3,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE,LAHF,PERF
cpu3 at mainbus0: apid 3 (application processor)
cpu3: Intel(R) Atom(TM) CPU N570 @ 1.66GHz ("GenuineIntel" 686-class) 1.67 GHz
cpu3: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,NXE,LONG,SSE3,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE,LAHF,PERF
ioapic0 at mainbus0: apid 4 pa 0xfec00000, version 20, 24 pins
acpimcfg0 at acpi0 addr 0xf0000000, bus 0-63
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 3 (P0P8)
acpiprt2 at acpi0: bus 2 (P0PA)
acpiprt3 at acpi0: bus -1 (P0PB)
acpiprt4 at acpi0: bus -1 (P0PC)
acpiprt5 at acpi0: bus 1 (P0P9)
acpiec0 at acpi0
acpicpu0 at acpi0:, C3, C2, C1, PSS
acpicpu1 at acpi0:, C3, C2, C1, PSS
acpicpu2 at acpi0:, C3, C2, C1, PSS
acpicpu3 at acpi0:, C3, C2, C1, PSS
acpibtn0 at acpi0: PWRB
acpibtn1 at acpi0: SLPB
acpibtn2 at acpi0: LID_
acpiac0 at acpi0: AC unit online
acpibat0 at acpi0: BAT1 model "LNV-L10C6Y12" serial 004706 type LiIon           
    oem "CPT-ES3"
acpivideo0 at acpi0: GFX0
acpivout0 at acpivideo0: DD02
bios0: ROM list: 0xc0000/0xda00! 0xce000/0x1000
cpu0: Enhanced SpeedStep 1663 MHz: speeds: 1667, 1334, 1000 MHz
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "Intel Pineview DMI" rev 0x02
vga1 at pci0 dev 2 function 0 "Intel Pineview Video" rev 0x02
intagp0 at vga1
agp0 at intagp0: aperture at 0xd0000000, size 0x10000000
inteldrm0 at vga1
drm0 at inteldrm0
intel_overlay_map_regs partial stub
inteldrm0: 1024x600
wsdisplay0 at vga1 mux 1: console (std, vt100 emulation)
wsdisplay0: screen 1-5 added (std, vt100 emulation)
"Intel Pineview Video" rev 0x02 at pci0 dev 2 function 1 not configured
azalia0 at pci0 dev 27 function 0 "Intel 82801GB HD Audio" rev 0x02: msi
azalia0: codecs: Realtek ALC269
audio0 at azalia0
ppb0 at pci0 dev 28 function 0 "Intel 82801GB PCIE" rev 0x02: apic 4 int 16
pci1 at ppb0 bus 1
re0 at pci1 dev 0 function 0 "Realtek 8101E" rev 0x05: RTL8105E (0x4080), msi, 
address 50:af:73:14:da:b5
rlphy0 at re0 phy 7: RTL8201E 10/100 PHY, rev. 2
ppb1 at pci0 dev 28 function 1 "Intel 82801GB PCIE" rev 0x02: apic 4 int 17
pci2 at ppb1 bus 2
"Realtek 8188CE" rev 0x01 at pci2 dev 0 function 0 not configured
uhci0 at pci0 dev 29 function 0 "Intel 82801GB USB" rev 0x02: apic 4 int 23
uhci1 at pci0 dev 29 function 1 "Intel 82801GB USB" rev 0x02: apic 4 int 19
uhci2 at pci0 dev 29 function 2 "Intel 82801GB USB" rev 0x02: apic 4 int 18
uhci3 at pci0 dev 29 function 3 "Intel 82801GB USB" rev 0x02: apic 4 int 16
ehci0 at pci0 dev 29 function 7 "Intel 82801GB USB" rev 0x02: apic 4 int 23
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1
ppb2 at pci0 dev 30 function 0 "Intel 82801BAM Hub-to-PCI" rev 0xe2
pci3 at ppb2 bus 3
pcib0 at pci0 dev 31 function 0 "Intel NM10 LPC" rev 0x02
ahci0 at pci0 dev 31 function 2 "Intel 82801GR AHCI" rev 0x02: msi, AHCI 1.1
scsibus0 at ahci0: 32 targets
sd0 at scsibus0 targ 0 lun 0: <ATA, HITACHI HTS54323, ES2Z> SCSI3 0/direct 
fixed naa.5000cca6c7d0d37f
sd0: 305245MB, 512 bytes/sector, 625142448 sectors
ichiic0 at pci0 dev 31 function 3 "Intel 82801GB SMBus" rev 0x02: apic 4 int 19
iic0 at ichiic0
spdmem0 at iic0 addr 0x50: 1GB DDR3 SDRAM PC3-10600 SO-DIMM
usb1 at uhci0: USB revision 1.0
uhub1 at usb1 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb2 at uhci1: USB revision 1.0
uhub2 at usb2 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb3 at uhci2: USB revision 1.0
uhub3 at usb3 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb4 at uhci3: USB revision 1.0
uhub4 at usb4 "Intel UHCI root hub" rev 1.00/1.00 addr 1
isa0 at pcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pms0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
wsmouse0 at pms0 mux 0
pms0: Elantech Touchpad, version 2, firmware 0x140000
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
mtrr: Pentium Pro MTRR support, 7 var ranges, 88 fixed ranges
run0 at uhub0 port 2 "Ralink 802.11 n WLAN" rev 2.00/1.01 addr 2
run0: MAC/BBP RT3070 (rev 0x0201), RF RT3020 (MIMO 1T1R), address 
10:6f:3f:ea:87:0c
umass0 at uhub0 port 5 configuration 1 interface 0 "Generic USB2.0-CRW" rev 
2.00/38.82 addr 3
umass0: using SCSI over Bulk-Only
scsibus1 at umass0: 2 targets, initiator 0
sd1 at scsibus1 targ 1 lun 0: <Generic-, Multi-Card, 1.00> SCSI0 0/direct 
removable serial.0bda0138516388200000
uvideo0 at uhub0 port 8 configuration 1 interface 0 "Lenovo Lenovo EasyCamera" 
rev 2.00/10.22 addr 4
video0 at uvideo0
ugen0 at uhub2 port 2 "Cambridge Silicon Radio Bluetooth" rev 2.00/52.76 addr 2
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
root on sd0a (65714a12cd3919f3.a) swap on sd0b dump on sd0b

-- 
the 4th world war will be fought with sticks and rocks.

Reply via email to