* [PATCH 1/1] usb: storage: Add quirk for Samsung Fit flash @ 2020-03-02 14:21 Jim Lin 2020-03-02 15:46 ` Alan Stern 2020-05-02 13:56 ` Atanas Dinev 0 siblings, 2 replies; 5+ messages in thread From: Jim Lin @ 2020-03-02 14:21 UTC (permalink / raw) To: stern, linux-usb; +Cc: usb-storage, Jim Lin 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. Signed-off-by: Jim Lin <jilin@nvidia.com> --- 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", -- 2.1.4 ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ----------------------------------------------------------------------------------- ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] usb: storage: Add quirk for Samsung Fit flash 2020-03-02 14:21 [PATCH 1/1] usb: storage: Add quirk for Samsung Fit flash Jim Lin @ 2020-03-02 15:46 ` Alan Stern 2020-05-02 13:56 ` Atanas Dinev 1 sibling, 0 replies; 5+ messages in thread From: Alan Stern @ 2020-03-02 15:46 UTC (permalink / raw) To: Jim Lin, Greg KH; +Cc: USB list, USB Storage list On Mon, 2 Mar 2020, Jim Lin wrote: > 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. > > Signed-off-by: Jim Lin <jilin@nvidia.com> > --- > 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", Acked-by: Alan Stern <stern@rowland.harvard.edu> ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] usb: storage: Add quirk for Samsung Fit flash 2020-03-02 14:21 [PATCH 1/1] usb: storage: Add quirk for Samsung Fit flash Jim Lin 2020-03-02 15:46 ` Alan Stern @ 2020-05-02 13:56 ` Atanas Dinev 2020-05-02 14:38 ` Jim Lin 1 sibling, 1 reply; 5+ messages in thread From: Atanas Dinev @ 2020-05-02 13:56 UTC (permalink / raw) To: Jim Lin, stern, linux-usb; +Cc: usb-storage 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@nvidia.com> > --- > 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] usb: storage: Add quirk for Samsung Fit flash 2020-05-02 13:56 ` Atanas Dinev @ 2020-05-02 14:38 ` Jim Lin 2022-09-12 12:58 ` sunghwan jung 0 siblings, 1 reply; 5+ messages in thread From: Jim Lin @ 2020-05-02 14:38 UTC (permalink / raw) To: Atanas Dinev, stern, linux-usb; +Cc: usb-storage In my case device will be in hung state even issuing port reset if without this patch. jim On 2020/5/2 下午9:56, Atanas Dinev wrote: > External email: Use caution opening links or attachments > > > 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@nvidia.com> >> --- >> 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", >> --nvpublic ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] usb: storage: Add quirk for Samsung Fit flash 2020-05-02 14:38 ` Jim Lin @ 2022-09-12 12:58 ` sunghwan jung 0 siblings, 0 replies; 5+ messages in thread From: sunghwan jung @ 2022-09-12 12:58 UTC (permalink / raw) To: jilin; +Cc: atanasd, linux-usb, stern, usb-storage On Mon, Sep 12, 2022 at 7:56 PM Jim Lin <jilin@nvidia.com> wrote: >On Sat, 2022-09-10 at 20:52 +0900, SungHwan Jung wrote: >External email: Use caution opening links or attachments >>I have found that the read rate of "samsung Bar plus" is slower than on windows 11 (210mb/s -> 70mb/s) and recovered by disabling quirks (using /etc/modprobe.d) >>This patch affects not only "Samsung Flash Driver FIT", but also other usb flash storages. (They may use the same controller?) >>But I can't reproduce the timeout problem without quirks. >>Could you provide information to reproduce the timeout problem or logs? >>It may help us find other solutions to fix it. >> >>Thanks, >>SungHwan. >Issue was reproduced after device has bad block. > >--nvpublic If bad blocks cause the issue, in my opinion, it's better to apply this quirk by users (additional kernel parameters with a bootloader) if their flash drive has bad blocks, not the kernel patch, because the performance degradation is severe for several USB storage that didn't have bad blocks. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-09-12 12:58 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-03-02 14:21 [PATCH 1/1] usb: storage: Add quirk for Samsung Fit flash Jim Lin 2020-03-02 15:46 ` Alan Stern 2020-05-02 13:56 ` Atanas Dinev 2020-05-02 14:38 ` Jim Lin 2022-09-12 12:58 ` sunghwan jung
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.