Bug 199759 - bogus optimal IO sizes for ASMedia ASM105x
Summary: bogus optimal IO sizes for ASMedia ASM105x
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: USB (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Greg Kroah-Hartman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-18 00:02 UTC by Christoph Anton Mitterer
Modified: 2019-09-19 11:35 UTC (History)
2 users (show)

See Also:
Kernel Version: 4.16
Tree: Mainline
Regression: No


Attachments

Description Christoph Anton Mitterer 2018-05-18 00:02:59 UTC
Hi.


I have some USB/SATA bridges from Inatek apparently based on different chipset generations:

My older ones:
May 11 22:41:08 heisenberg kernel: usb 4-2.2: new SuperSpeed USB device number 10 using xhci_hcd
May 11 22:41:08 heisenberg kernel: usb 4-2.2: New USB device found, idVendor=174c, idProduct=55aa
May 11 22:41:08 heisenberg kernel: usb 4-2.2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
May 11 22:41:08 heisenberg kernel: usb 4-2.2: Product: ASMT1053
May 11 22:41:08 heisenberg kernel: usb 4-2.2: Manufacturer: asmedia
May 11 22:41:08 heisenberg kernel: usb 4-2.2: SerialNumber: 123456789012
May 11 22:41:08 heisenberg kernel: usb 4-2.2: Device is not authorized for usage
May 11 22:41:11 heisenberg kernel: usb-storage 4-2.2:1.0: USB Mass Storage device detected
May 11 22:41:11 heisenberg kernel: usb-storage 4-2.2:1.0: Quirks match for vid 174c pid 55aa: 400000
May 11 22:41:11 heisenberg kernel: scsi host6: usb-storage 4-2.2:1.0
May 11 22:41:11 heisenberg kernel: usb 4-2.2: authorized to connect
May 11 22:41:12 heisenberg kernel: scsi 6:0:0:0: Direct-Access     ASMT     2105             0    PQ: 0 ANSI: 6
May 11 22:41:12 heisenberg kernel: sd 6:0:0:0: Attached scsi generic sg1 type 0
May 11 22:41:12 heisenberg kernel: sd 6:0:0:0: [sdb] Spinning up disk...
May 11 22:41:26 heisenberg kernel: ..............ready
May 11 22:41:26 heisenberg kernel: sd 6:0:0:0: [sdb] 15628053168 512-byte logical blocks: (8.00 TB/7.28 TiB)
May 11 22:41:26 heisenberg kernel: sd 6:0:0:0: [sdb] 4096-byte physical blocks
May 11 22:41:26 heisenberg kernel: sd 6:0:0:0: [sdb] Write Protect is off
May 11 22:41:26 heisenberg kernel: sd 6:0:0:0: [sdb] Mode Sense: 43 00 00 00
May 11 22:41:26 heisenberg kernel: sd 6:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
May 11 22:41:27 heisenberg kernel:  sdb: sdb1 sdb2
May 11 22:41:27 heisenberg kernel: sd 6:0:0:0: [sdb] Attached SCSI disk

Which give:
# lsblk -t /dev/sdb
NAME        ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE  RA WSAME
sdb                 0   4096      0    4096     512    1 cfq       128 128    0B
├─sdb1              0   4096      0    4096     512    1 cfq       128 128    0B
│ └─data-a1         0   4096      0    4096     512    1           128 128    0B
└─sdb2              0   4096      0    4096     512    1 cfq       128 128    0B
# cat /sys/block/sdb/queue/optimal_io_size
0
for a connected SATA HDD.


And newer ones:
May 11 22:31:50 heisenberg kernel: usb 4-2.2: new SuperSpeed USB device number 8 using xhci_hcd
May 11 22:31:50 heisenberg kernel: usb 4-2.2: New USB device found, idVendor=174c, idProduct=55aa
May 11 22:31:50 heisenberg kernel: usb 4-2.2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
May 11 22:31:50 heisenberg kernel: usb 4-2.2: Product: ASM105x
May 11 22:31:50 heisenberg kernel: usb 4-2.2: Manufacturer: ASMedia
May 11 22:31:50 heisenberg kernel: usb 4-2.2: SerialNumber:             Z84134CP
May 11 22:31:50 heisenberg kernel: usb 4-2.2: Device is not authorized for usage
May 11 22:31:52 heisenberg kernel: usb 4-2.2: authorized to connect
May 11 22:31:52 heisenberg kernel: scsi host6: uas
May 11 22:31:52 heisenberg kernel: usbcore: registered new interface driver uas
May 11 22:31:52 heisenberg kernel: scsi 6:0:0:0: Direct-Access     ASMedia  ASM105x          0    PQ: 0 ANSI: 6
May 11 22:31:52 heisenberg kernel: sd 6:0:0:0: Attached scsi generic sg1 type 0
May 11 22:31:52 heisenberg kernel: sd 6:0:0:0: [sdb] 15628053168 512-byte logical blocks: (8.00 TB/7.28 TiB)
May 11 22:31:52 heisenberg kernel: sd 6:0:0:0: [sdb] 4096-byte physical blocks
May 11 22:31:52 heisenberg kernel: sd 6:0:0:0: [sdb] Write Protect is off
May 11 22:31:52 heisenberg kernel: sd 6:0:0:0: [sdb] Mode Sense: 43 00 00 00
May 11 22:31:52 heisenberg kernel: sd 6:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
May 11 22:31:52 heisenberg kernel:  sdb: sdb1 sdb2
May 11 22:31:52 heisenberg kernel: sd 6:0:0:0: [sdb] Attached SCSI disk
May 11 22:31:52 heisenberg kernel: BTRFS: device label data-a1-meta devid 1 transid 316 /dev/sdb2

Which give:
# lsblk -t /dev/sdb
NAME        ALIGNMENT MIN-IO   OPT-IO PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE  RA WSAME
sdb                 0   4096 33553920    4096     512    1 cfq       128 128   32M
├─sdb1              0   4096 33553920    4096     512    1 cfq       128 128   32M
│ └─data-a1        -1   4096        0    4096     512    1           128 128    0B
└─sdb2              0   4096 33553920    4096     512    1 cfq       128 128   32M
# cat /sys/block/sdb/queue/optimal_io_size
33553920

And additionally these warnings in the kernel log:
May 11 22:32:51 heisenberg kernel: NET: Registered protocol family 38
May 11 22:32:58 heisenberg kernel: device-mapper: table: 253:1: adding target device sdb1 caused an alignment inconsistency: physical_block_size=4096, logical_block_size=512, alignment_offset=0, start=2097152
May 11 22:32:58 heisenberg kernel: device-mapper: table: 253:1: adding target device sdb1 caused an alignment inconsistency: physical_block_size=4096, logical_block_size=512, alignment_offset=0, start=2097152
May 11 22:32:58 heisenberg kernel: device-mapper: table: 253:1: adding target device sdb1 caused an alignment inconsistency: physical_block_size=4096, logical_block_size=512, alignment_offset=0, start=2097152
May 11 22:32:58 heisenberg kernel: device-mapper: table: 253:1: adding target device sdb1 caused an alignment inconsistency: physical_block_size=4096, logical_block_size=512, alignment_offset=0, start=2097152
May 11 22:32:58 heisenberg kernel: BTRFS: device label data-a1 devid 1 transid 67002 /dev/dm-1
May 11 22:33:02 heisenberg kernel: BTRFS info (device dm-1): use zlib compression, level 3
May 11 22:33:02 heisenberg kernel: BTRFS info (device dm-1): disk space caching is enabled
May 11 22:33:02 heisenberg kernel: BTRFS info (device dm-1): has skinny extents


Apparently the optimal IO sizes reported by the ASMedia ASM105x is bogus.

Not sure whether the kernel provides means to work around quirks at this level, but in case it does it would be nice if some reasonable value could be used to override the opt io of 33553920.


Thanks,
Chris.
Comment 1 Greg Kroah-Hartman 2018-05-18 06:49:25 UTC
On Fri, May 18, 2018 at 12:02:59AM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=199759
> 
>             Bug ID: 199759
>            Summary: bogus optimal IO sizes for ASMedia ASM105x
>            Product: Drivers
>            Version: 2.5
>     Kernel Version: 4.16

All USB bugs should be sent to the linux-usb@vger.kernel.org mailing
list, and not entered into bugzilla.  Please bring this issue up there,
if it is still a problem in the latest kernel release.
Comment 2 Christoph Anton Mitterer 2018-06-17 19:06:23 UTC
Reported it on both, linux-usb@vger.kernel.org and linux-scsi@vger.kernel.org, but no apparent outcome.

Note You need to log in before you can comment on or make changes to this bug.