Re: [PATCH 1/1] usb: storage: Add quirk for Samsung Fit flash

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

 



Hello,

Jim Lin wrote on 02.03.20 15:21:
Current driver has 240 (USB2.0) and 2048 (USB3.0) as max_sectors,
e.g., /sys/bus/scsi/devices/0:0:0:0/max_sectors

If data access times out, driver error handling will issue a port
reset.
Sometimes Samsung Fit (090C:1000) flash disk will not respond to
later Set Address or Get Descriptor command.

Adding this quirk to limit max_sectors to 64 sectors to avoid issue
occurring.

This may need revisiting as it appears to be a performance killer (3-4 times slower seq reads) for otherwise perfectly working sticks.
Going down from 2048 to 64 seems to cause a pretty significant speed degradation.
Here are a few examples:

# lsusb
Bus 002 Device 012: ID 090c:1000 Silicon Motion, Inc. - Taiwan (formerly Feiya Technology Corp.) Flash Drive
# lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
    |__ Port 3: Dev 12, If 0, Class=Mass Storage, Driver=usb-storage, 5000M

# dmesg
[23153.493726] usb 2-3: Product: Flash Drive FIT
[23153.493729] usb 2-3: Manufacturer: Samsung
[23153.493731] usb 2-3: SerialNumber: 0375119090033353
[23153.575386] usb-storage 2-3:1.0: USB Mass Storage device detected
[23153.575514] usb-storage 2-3:1.0: Quirks match for vid 090c pid 1000: 400
[23153.575559] scsi host2: usb-storage 2-3:1.0
[23153.576529] usbcore: registered new interface driver usb-storage
[23153.578645] usbcore: registered new interface driver uas

# cat /proc/scsi/usb-storage/*
   Host scsi2: usb-storage
       Vendor: Samsung
      Product: Flash Drive FIT
Serial Number: 0375119090033353
     Protocol: Transparent SCSI
    Transport: Bulk
       Quirks: MAX_SECTORS_64 SANE_SENSE

# hdparm -t /dev/sdb
 Timing buffered disk reads: 132 MB in  3.03 seconds = 43.62 MB/sec
# dd if=/dev/sdb of=/dev/null bs=1M count=1000
1048576000 bytes (1,0 GB, 1000 MiB) copied, 22,3564 s, 46,9 MB/s

# rmmod uas usb_storage
# modprobe usb_storage quirks=090c:1000:

# hdparm -t /dev/sdb
 Timing buffered disk reads: 452 MB in  3.01 seconds = 150.33 MB/sec
# dd if=/dev/sdb of=/dev/null bs=1M count=1000
1048576000 bytes (1,0 GB, 1000 MiB) copied, 6,51492 s, 161 MB/s


[23612.690798] usb 2-3: Product: Intenso High Speed Line
[23612.690799] usb 2-3: Manufacturer: SMI
[23612.690801] usb 2-3: SerialNumber: 19112500000332
[23612.780771] usb-storage 2-3:1.0: USB Mass Storage device detected
[23612.780895] usb-storage 2-3:1.0: Quirks match for vid 090c pid 1000: 400
[23612.780940] scsi host2: usb-storage 2-3:1.0
[23612.781093] usbcore: registered new interface driver usb-storage
[23612.783226] usbcore: registered new interface driver uas

# cat /proc/scsi/usb-storage/*
   Host scsi2: usb-storage
       Vendor: SMI
      Product: Intenso High Speed Line
Serial Number: 19112500000332
     Protocol: Transparent SCSI
    Transport: Bulk
       Quirks: MAX_SECTORS_64 SANE_SENSE

# hdparm -t /dev/sdb
 Timing buffered disk reads: 220 MB in  3.00 seconds = 73.22 MB/sec
# dd if=/dev/sdb of=/dev/null bs=1M count=1000
1048576000 bytes (1,0 GB, 1000 MiB) copied, 11,5469 s, 90,8 MB/s

# rmmod uas usb_storage
# modprobe usb_storage quirks=090c:1000:
# hdparm -t /dev/sdb
Timing buffered disk reads: 1016 MB in  3.00 seconds = 338.51 MB/sec
# dd if=/dev/sdb of=/dev/null bs=1M count=1000
1048576000 bytes (1,0 GB, 1000 MiB) copied, 3,31022 s, 317 MB/s


I'm using both sticks as a bootable/emergency media (Debian stable, kernel 4.19/no-quirks with X, XFCE, web browser, etc) and haven't had any issues with timeouts, unresponsiveness or whatsoever.

When tested with recent kernels (e.g. Debian testing/5.5, Ubuntu 20.04 LTS/5.4) it's slow.

Setting "options usb_storage quirks=090c:1000:" in /etc/modprobe.d as a workaround for now.

Signed-off-by: Jim Lin <jilin@xxxxxxxxxx>
---
  drivers/usb/storage/unusual_devs.h | 6 ++++++
  1 file changed, 6 insertions(+)

diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 1cd9b6305b06..1880f3e13f57 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -1258,6 +1258,12 @@ UNUSUAL_DEV( 0x090a, 0x1200, 0x0000, 0x9999,
  		USB_SC_RBC, USB_PR_BULK, NULL,
  		0 ),
+UNUSUAL_DEV(0x090c, 0x1000, 0x1100, 0x1100,
+		"Samsung",
+		"Flash Drive FIT",
+		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+		US_FL_MAX_SECTORS_64),
+
  /* aeb */
  UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff,
  		"Feiya",


Thanks,
Atanas



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

  Powered by Linux