All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jim Lin <jilin@nvidia.com>
To: Atanas Dinev <atanasd@gmail.com>, <stern@rowland.harvard.edu>,
	<linux-usb@vger.kernel.org>
Cc: <usb-storage@lists.one-eyed-alien.net>
Subject: Re: [PATCH 1/1] usb: storage: Add quirk for Samsung Fit flash
Date: Sat, 2 May 2020 22:38:27 +0800	[thread overview]
Message-ID: <095677b6-5b6c-1b35-fe9e-00dcedd0a11f@nvidia.com> (raw)
In-Reply-To: <bb4db5cf-60bc-9c0f-e1dc-3047542d2b42@gmail.com>

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

  reply	other threads:[~2020-05-02 14:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-09-12 12:58     ` sunghwan jung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=095677b6-5b6c-1b35-fe9e-00dcedd0a11f@nvidia.com \
    --to=jilin@nvidia.com \
    --cc=atanasd@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=usb-storage@lists.one-eyed-alien.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.