JMS56x not working reliably with uas driver
diff mbox

Message ID 585A69E6.6040009@caviumnetworks.com
State Not Applicable, archived
Headers show

Commit Message

George Cherian Dec. 21, 2016, 11:39 a.m. UTC
Hi Oliver,

I was working with this JMicron device and using the uas driver.
I am seeing the following 2 issues.

1) On connect I see the following messages.
xhci_hcd 0000:00:11.0: ERROR Transfer event for disabled endpoint or 
incorrect stream ring
  This was eliminated using the following scissor patch.

---------------------------------8<------------------------------------
[PATCH] usb: storage: unusual_uas: Add JMicron JMS56x to unusual device

This device gives the following error on detection.
xhci_hcd 0000:00:11.0: ERROR Transfer event for disabled endpoint or 
incorrect stream ring

The same error is not seen when it is added to unusual_device
list with US_FL_NO_REPORT_OPCODES passed.

Signed-off-by: George Cherian <george.cherian@cavium.com>
---
  drivers/usb/storage/unusual_uas.h | 7 +++++++
  1 file changed, 7 insertions(+)

--------------------------------->8------------------------------------

2) On disconnect I am seeing the following issue

  scsi host4: uas_post_reset: alloc streams error -19 after reset
  sd 4:0:0:0: [sdb] Synchronizing SCSI cache

This is more fatal because after these messages the USB port becomes 
unusable. Even an lsusb invocation hangs for ever.

Also please note that the device works fine with usb-storage driver.
I am attaching the usbmon capture of disconnect using uas and 
usb-storage driver.

Any help in this regard is highly appreciated.

Regards,
-George
ffff801f5efb8a00 57530621 C Ii:4:002:1 0:128 1 = 08
ffff801f5efb8a00 57530654 S Ii:4:002:1 -115:128 2 <
ffff801f61285a00 57530677 S Ci:4:002:0 s a3 00 0000 0003 0004 4 <
ffff801f61285a00 57531618 C Ci:4:002:0 0 4 = c1024000
ffff801f61285a00 57531634 S Co:4:002:0 s 23 01 0019 0003 0000 0
ffff801f61285a00 57531992 C Co:4:002:0 0 0
ffff801f61285a00 57532225 S Ci:4:002:0 s a3 00 0000 0003 0004 4 <
ffff801f61285a00 57533010 C Ci:4:002:0 0 4 = c1020000
ffff801f61285a00 57533022 S Co:4:002:0 s 23 03 001c 0003 0000 0
ffff801f61285a00 57533405 C Co:4:002:0 0 0
ffff801f61285a00 57553165 S Ci:4:002:0 s a3 00 0000 0003 0004 4 <
ffff801f61285a00 57554174 C Ci:4:002:0 0 4 = b1020000
ffff801f61285a00 57573164 S Ci:4:002:0 s a3 00 0000 0003 0004 4 <
ffff801f61285a00 57574064 C Ci:4:002:0 0 4 = b1020000
ffff801f61285a00 57593169 S Ci:4:002:0 s a3 00 0000 0003 0004 4 <
ffff801f61285a00 57594214 C Ci:4:002:0 0 4 = b1020000
ffff801f5efb8a00 57642612 C Ii:4:002:1 0:128 1 = 08
ffff801f5efb8a00 57642621 S Ii:4:002:1 -115:128 2 <
ffff801f5efb8a00 57658612 C Ii:4:002:1 0:128 1 = 08
ffff801f5efb8a00 57658618 S Ii:4:002:1 -115:128 2 <
ffff801f5efb8a00 57674611 C Ii:4:002:1 0:128 1 = 08
ffff801f5efb8a00 57674617 S Ii:4:002:1 -115:128 2 <
ffff801f5efb8a00 57690610 C Ii:4:002:1 0:128 1 = 08
ffff801f5efb8a00 57690615 S Ii:4:002:1 -115:128 2 <
ffff801f5efb8a00 57706609 C Ii:4:002:1 0:128 1 = 08
ffff801f5efb8a00 57706615 S Ii:4:002:1 -115:128 2 <
ffff801f5efb8a00 57722609 C Ii:4:002:1 0:128 1 = 08
ffff801f5efb8a00 57722614 S Ii:4:002:1 -115:128 2 <
ffff801f5efb8a00 57738611 C Ii:4:002:1 0:128 1 = 08
ffff801f5efb8a00 57738616 S Ii:4:002:1 -115:128 2 <
ffff801f5efb8a00 57754610 C Ii:4:002:1 0:128 1 = 08
ffff801f5efb8a00 57754615 S Ii:4:002:1 -115:128 2 <
ffff801f5efb8a00 57770607 C Ii:4:002:1 0:128 1 = 08
ffff801f5efb8a00 57770612 S Ii:4:002:1 -115:128 2 <
ffff801f5efb8a00 57786609 C Ii:4:002:1 0:128 1 = 08
ffff801f5efb8a00 57786614 S Ii:4:002:1 -115:128 2 <
ffff801f5efb8a00 57802608 C Ii:4:002:1 0:128 1 = 08
ffff801f5efb8a00 57802613 S Ii:4:002:1 -115:128 2 <
ffff801f61285a00 57803198 S Ci:4:002:0 s a3 00 0000 0003 0004 4 <
ffff801f61285a00 57804109 C Ci:4:002:0 0 4 = a0020100
ffff801f61285a00 57804122 S Co:4:002:0 s 23 01 0014 0003 0000 0
ffff801f61285a00 57804539 C Co:4:002:0 0 0
ffff801f61285a00 57804553 S Co:4:002:0 s 23 01 001d 0003 0000 0
ffff801f61285a00 57804876 C Co:4:002:0 0 0
ffff801f61285a00 57804890 S Co:4:002:0 s 23 01 0019 0003 0000 0
ffff801f61285a00 57805185 C Co:4:002:0 0 0
ffff801f61285a00 57805199 S Co:4:002:0 s 23 01 0010 0003 0000 0
ffff801f61285a00 57805735 C Co:4:002:0 0 0
ffff801f61285a00 57805749 S Ci:4:002:0 s a3 00 0000 0003 0004 4 <
ffff801f61285a00 57806491 C Ci:4:002:0 0 4 = a0020000
ffff801f61285a00 57806506 S Ci:4:002:0 s a3 00 0000 0003 0004 4 <
ffff801f61285a00 57806895 C Ci:4:002:0 0 4 = a0020000
ffff801f61285a00 57806910 S Ci:4:002:0 s a3 00 0000 0003 0004 4 <
ffff801f61285a00 57807355 C Ci:4:002:0 0 4 = a0020000
ffff801fde9b7100 2508261441 C Ii:4:002:1 0:128 1 = 08
ffff801fde9b7100 2508261475 S Ii:4:002:1 -115:128 2 <
ffff801fdaf84200 2508261591 S Ci:4:002:0 s a3 00 0000 0003 0004 4 <
ffff801fdaf84200 2508262561 C Ci:4:002:0 0 4 = a0024100
ffff801fdaf84200 2508262596 S Co:4:002:0 s 23 01 0010 0003 0000 0
ffff801fdaf84200 2508263060 C Co:4:002:0 0 0
ffff801fdaf84200 2508263118 S Co:4:002:0 s 23 01 0019 0003 0000 0
ffff801fdaf84200 2508263569 C Co:4:002:0 0 0
ffff801fdaf84e00 2508303619 S Ci:4:002:0 s a3 00 0000 0003 0004 4 <
ffff801fdaf84e00 2508304568 C Ci:4:002:0 0 4 = a0020000
ffff801fdaf8cb00 2508343090 S Ci:4:002:0 s a3 00 0000 0003 0004 4 <
ffff801fdaf8cb00 2508344057 C Ci:4:002:0 0 4 = a0020000
ffff801fdaf8cb00 2508383090 S Ci:4:002:0 s a3 00 0000 0003 0004 4 <
ffff801fdaf8cb00 2508384002 C Ci:4:002:0 0 4 = a0020000
ffff801fdaf8cb00 2508423124 S Ci:4:002:0 s a3 00 0000 0003 0004 4 <
ffff801fdaf8cb00 2508424178 C Ci:4:002:0 0 4 = a0020000
ffff801fdaf8cb00 2508463093 S Ci:4:002:0 s a3 00 0000 0003 0004 4 <
ffff801fdaf8cb00 2508463992 C Ci:4:002:0 0 4 = a0020000

Comments

George Cherian Dec. 21, 2016, 12:07 p.m. UTC | #1
On 12/21/2016 05:12 PM, Oliver Neukum wrote:
> On Wed, 2016-12-21 at 17:09 +0530, George Cherian wrote:
>> Hi Oliver,
>>
>> I was working with this JMicron device and using the uas driver.
>> I am seeing the following 2 issues.
>>
>> 1) On connect I see the following messages.
>
> Thanks. Do you want to submit it to Greg?
> The patch is fine.
Yes please!!!

>
>> 2) On disconnect I am seeing the following issue
>>
>>    scsi host4: uas_post_reset: alloc streams error -19 after reset
>>    sd 4:0:0:0: [sdb] Synchronizing SCSI cache
>>
>> This is more fatal because after these messages the USB port becomes
>> unusable. Even an lsusb invocation hangs for ever.
>
> Ouch. That points to a logic error. We should not reset if
> a device is gone.
> Could you send dmesg of such a case?
here is the dmesg!!
[  203.475382] usb 4-1.3: new SuperSpeed USB device number 3 using xhci_hcd
[  203.496172] usb 4-1.3: New USB device found, idVendor=152d, 
idProduct=9561
[  203.503037] usb 4-1.3: New USB device strings: Mfr=1, Product=2, 
SerialNumber=5
[  203.510352] usb 4-1.3: Product: JMS56x Series
[  203.514698] usb 4-1.3: Manufacturer: JMicron
[  203.518966] usb 4-1.3: SerialNumber: 00000000000000000000
[  203.594383] usbcore: registered new interface driver usb-storage
[  203.612425] scsi host4: uas
[  203.615418] usbcore: registered new interface driver uas
[  203.620979] scsi 4:0:0:0: Direct-Access     ST4000NM 0033-9ZM170 
  0001 PQ: 0 ANSI: 6
[  203.630240] sd 4:0:0:0: Attached scsi generic sg1 type 0
[  203.630382] sd 4:0:0:0: [sdb] 7814037168 512-byte logical blocks: 
(4.00 TB/3.63 TiB)
[  203.631338] sd 4:0:0:0: [sdb] Write Protect is off
[  203.631342] sd 4:0:0:0: [sdb] Mode Sense: 67 00 10 08
[  203.631734] sd 4:0:0:0: [sdb] Write cache: enabled, read cache: 
enabled, supports DPO and FUA
[  203.631899] xhci_hcd 0000:00:11.0: ERROR Transfer event for disabled 
endpoint or incorrect stream ring
[  203.631904] xhci_hcd 0000:00:11.0: @0000001f610a1c10 00000000 
00000000 1b000000 03078001 state 14 ep_info 9403
[  203.631906] xhci_hcd 0000:00:11.0: No epring
[  203.674546]  sdb: sdb1
[  203.676639] sd 4:0:0:0: [sdb] Attached SCSI disk
[  213.222913] scsi host4: uas_post_reset: alloc streams error -19 after 
reset
[  213.230548] sd 4:0:0:0: [sdb] Synchronizing SCSI cache

Above is the dmesg without the unusual_uas patch applied.
Do you need me to enable any specific dev_dbg and then the dmesg output?

>
> 	Regards
> 		Oliver
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Oliver Neukum Dec. 21, 2016, 12:12 p.m. UTC | #2
On Wed, 2016-12-21 at 17:37 +0530, George Cherian wrote:
> 
> On 12/21/2016 05:12 PM, Oliver Neukum wrote:
> > On Wed, 2016-12-21 at 17:09 +0530, George Cherian wrote:
> >> Hi Oliver,
> >>
> >> I was working with this JMicron device and using the uas driver.
> >> I am seeing the following 2 issues.
> >>
> >> 1) On connect I see the following messages.
> >
> > Thanks. Do you want to submit it to Greg?
> > The patch is fine.
> Yes please!!!

So you want me to submit it?
It would be your chance to get a patch upstream.

> >> 2) On disconnect I am seeing the following issue
> >>
> >>    scsi host4: uas_post_reset: alloc streams error -19 after reset
> >>    sd 4:0:0:0: [sdb] Synchronizing SCSI cache
> >>
> >> This is more fatal because after these messages the USB port becomes
> >> unusable. Even an lsusb invocation hangs for ever.
> >
> > Ouch. That points to a logic error. We should not reset if
> > a device is gone.
> > Could you send dmesg of such a case?
> here is the dmesg!!
> [  203.475382] usb 4-1.3: new SuperSpeed USB device number 3 using xhci_hcd
> [  203.496172] usb 4-1.3: New USB device found, idVendor=152d, 
> idProduct=9561
> [  203.503037] usb 4-1.3: New USB device strings: Mfr=1, Product=2, 
> SerialNumber=5
> [  203.510352] usb 4-1.3: Product: JMS56x Series
> [  203.514698] usb 4-1.3: Manufacturer: JMicron
> [  203.518966] usb 4-1.3: SerialNumber: 00000000000000000000
> [  203.594383] usbcore: registered new interface driver usb-storage
> [  203.612425] scsi host4: uas
> [  203.615418] usbcore: registered new interface driver uas
> [  203.620979] scsi 4:0:0:0: Direct-Access     ST4000NM 0033-9ZM170 
>   0001 PQ: 0 ANSI: 6
> [  203.630240] sd 4:0:0:0: Attached scsi generic sg1 type 0
> [  203.630382] sd 4:0:0:0: [sdb] 7814037168 512-byte logical blocks: 
> (4.00 TB/3.63 TiB)
> [  203.631338] sd 4:0:0:0: [sdb] Write Protect is off
> [  203.631342] sd 4:0:0:0: [sdb] Mode Sense: 67 00 10 08
> [  203.631734] sd 4:0:0:0: [sdb] Write cache: enabled, read cache: 
> enabled, supports DPO and FUA
> [  203.631899] xhci_hcd 0000:00:11.0: ERROR Transfer event for disabled 
> endpoint or incorrect stream ring
> [  203.631904] xhci_hcd 0000:00:11.0: @0000001f610a1c10 00000000 
> 00000000 1b000000 03078001 state 14 ep_info 9403
> [  203.631906] xhci_hcd 0000:00:11.0: No epring
> [  203.674546]  sdb: sdb1
> [  203.676639] sd 4:0:0:0: [sdb] Attached SCSI disk
> [  213.222913] scsi host4: uas_post_reset: alloc streams error -19 after 
> reset
> [  213.230548] sd 4:0:0:0: [sdb] Synchronizing SCSI cache
> 
> Above is the dmesg without the unusual_uas patch applied.
> Do you need me to enable any specific dev_dbg and then the dmesg output?

Damn, that is a strange error. Do you know whether it happens on other
XHCI controllers? Which controller are you using and can you please also
post "lsusb -v"?

	Regards
		Oliver


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hans de Goede Dec. 21, 2016, 12:20 p.m. UTC | #3
Hi,

On 21-12-16 13:07, George Cherian wrote:
>
>
> On 12/21/2016 05:12 PM, Oliver Neukum wrote:
>> On Wed, 2016-12-21 at 17:09 +0530, George Cherian wrote:
>>> Hi Oliver,
>>>
>>> I was working with this JMicron device and using the uas driver.
>>> I am seeing the following 2 issues.
>>>
>>> 1) On connect I see the following messages.
>>
>> Thanks. Do you want to submit it to Greg?
>> The patch is fine.
> Yes please!!!
>
>>
>>> 2) On disconnect I am seeing the following issue
>>>
>>>    scsi host4: uas_post_reset: alloc streams error -19 after reset
>>>    sd 4:0:0:0: [sdb] Synchronizing SCSI cache
>>>
>>> This is more fatal because after these messages the USB port becomes
>>> unusable. Even an lsusb invocation hangs for ever.
>>
>> Ouch. That points to a logic error. We should not reset if
>> a device is gone.
>> Could you send dmesg of such a case?
> here is the dmesg!!
> [  203.475382] usb 4-1.3: new SuperSpeed USB device number 3 using xhci_hcd
> [  203.496172] usb 4-1.3: New USB device found, idVendor=152d, idProduct=9561
> [  203.503037] usb 4-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=5
> [  203.510352] usb 4-1.3: Product: JMS56x Series
> [  203.514698] usb 4-1.3: Manufacturer: JMicron
> [  203.518966] usb 4-1.3: SerialNumber: 00000000000000000000
> [  203.594383] usbcore: registered new interface driver usb-storage
> [  203.612425] scsi host4: uas
> [  203.615418] usbcore: registered new interface driver uas
> [  203.620979] scsi 4:0:0:0: Direct-Access     ST4000NM 0033-9ZM170  0001 PQ: 0 ANSI: 6
> [  203.630240] sd 4:0:0:0: Attached scsi generic sg1 type 0
> [  203.630382] sd 4:0:0:0: [sdb] 7814037168 512-byte logical blocks: (4.00 TB/3.63 TiB)
> [  203.631338] sd 4:0:0:0: [sdb] Write Protect is off
> [  203.631342] sd 4:0:0:0: [sdb] Mode Sense: 67 00 10 08
> [  203.631734] sd 4:0:0:0: [sdb] Write cache: enabled, read cache: enabled, supports DPO and FUA
> [  203.631899] xhci_hcd 0000:00:11.0: ERROR Transfer event for disabled endpoint or incorrect stream ring
> [  203.631904] xhci_hcd 0000:00:11.0: @0000001f610a1c10 00000000 00000000 1b000000 03078001 state 14 ep_info 9403
> [  203.631906] xhci_hcd 0000:00:11.0: No epring
> [  203.674546]  sdb: sdb1
> [  203.676639] sd 4:0:0:0: [sdb] Attached SCSI disk
> [  213.222913] scsi host4: uas_post_reset: alloc streams error -19 after reset
> [  213.230548] sd 4:0:0:0: [sdb] Synchronizing SCSI cache
>
> Above is the dmesg without the unusual_uas patch applied.
> Do you need me to enable any specific dev_dbg and then the dmesg output?

Can you get us a dmesg with the unusual_uas patch applied? Usually once things go foobar because
of issue-ing a command which the device does not understand, more things typically come down
as both the device and the host may be in an undefined state then.

Regards,

Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
George Cherian Dec. 21, 2016, 12:47 p.m. UTC | #4
On 12/21/2016 05:50 PM, Hans de Goede wrote:
> Hi,
>
> On 21-12-16 13:07, George Cherian wrote:
>>
>>
>> On 12/21/2016 05:12 PM, Oliver Neukum wrote:
>>> On Wed, 2016-12-21 at 17:09 +0530, George Cherian wrote:
>>>> Hi Oliver,
>>>>
>>>> I was working with this JMicron device and using the uas driver.
>>>> I am seeing the following 2 issues.
>>>>
>>>> 1) On connect I see the following messages.
>>>
>>> Thanks. Do you want to submit it to Greg?
>>> The patch is fine.
>> Yes please!!!
>>
>>>
>>>> 2) On disconnect I am seeing the following issue
>>>>
>>>>    scsi host4: uas_post_reset: alloc streams error -19 after reset
>>>>    sd 4:0:0:0: [sdb] Synchronizing SCSI cache
>>>>
>>>> This is more fatal because after these messages the USB port becomes
>>>> unusable. Even an lsusb invocation hangs for ever.
>>>
>>> Ouch. That points to a logic error. We should not reset if
>>> a device is gone.
>>> Could you send dmesg of such a case?
>> here is the dmesg!!
>> [  203.475382] usb 4-1.3: new SuperSpeed USB device number 3 using
>> xhci_hcd
>> [  203.496172] usb 4-1.3: New USB device found, idVendor=152d,
>> idProduct=9561
>> [  203.503037] usb 4-1.3: New USB device strings: Mfr=1, Product=2,
>> SerialNumber=5
>> [  203.510352] usb 4-1.3: Product: JMS56x Series
>> [  203.514698] usb 4-1.3: Manufacturer: JMicron
>> [  203.518966] usb 4-1.3: SerialNumber: 00000000000000000000
>> [  203.594383] usbcore: registered new interface driver usb-storage
>> [  203.612425] scsi host4: uas
>> [  203.615418] usbcore: registered new interface driver uas
>> [  203.620979] scsi 4:0:0:0: Direct-Access     ST4000NM 0033-9ZM170
>> 0001 PQ: 0 ANSI: 6
>> [  203.630240] sd 4:0:0:0: Attached scsi generic sg1 type 0
>> [  203.630382] sd 4:0:0:0: [sdb] 7814037168 512-byte logical blocks:
>> (4.00 TB/3.63 TiB)
>> [  203.631338] sd 4:0:0:0: [sdb] Write Protect is off
>> [  203.631342] sd 4:0:0:0: [sdb] Mode Sense: 67 00 10 08
>> [  203.631734] sd 4:0:0:0: [sdb] Write cache: enabled, read cache:
>> enabled, supports DPO and FUA
>> [  203.631899] xhci_hcd 0000:00:11.0: ERROR Transfer event for
>> disabled endpoint or incorrect stream ring
>> [  203.631904] xhci_hcd 0000:00:11.0: @0000001f610a1c10 00000000
>> 00000000 1b000000 03078001 state 14 ep_info 9403
>> [  203.631906] xhci_hcd 0000:00:11.0: No epring
>> [  203.674546]  sdb: sdb1
>> [  203.676639] sd 4:0:0:0: [sdb] Attached SCSI disk
>> [  213.222913] scsi host4: uas_post_reset: alloc streams error -19
>> after reset
>> [  213.230548] sd 4:0:0:0: [sdb] Synchronizing SCSI cache
>>
>> Above is the dmesg without the unusual_uas patch applied.
>> Do you need me to enable any specific dev_dbg and then the dmesg output?
>
> Can you get us a dmesg with the unusual_uas patch applied? Usually once
> things go foobar because
> of issue-ing a command which the device does not understand, more things
> typically come down
> as both the device and the host may be in an undefined state then.

Here is the lsusb -t
============================================================================
lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 5000M
     |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
         |__ Port 3: Dev 4, If 0, Class=Mass Storage, Driver=uas, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
     |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M

lsusb
Bus 003 Device 002: ID 0bda:5401 Realtek Semiconductor Corp. RTL 8153 
USB 3.0 hub with gigabit ethernet
Bus 004 Device 002: ID 0bda:0401 Realtek Semiconductor Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 004 Device 004: ID 152d:9561 JMicron Technology Corp. / JMicron USA 
Technology Corp.
lsusb -v
Bus 004 Device 004: ID 152d:9561 JMicron Technology Corp. / JMicron USA 
Technology Corp.
Device Descriptor:
   bLength                18
   bDescriptorType         1
   bcdUSB               3.00
   bDeviceClass            0 (Defined at Interface level)
   bDeviceSubClass         0
   bDeviceProtocol         0
   bMaxPacketSize0         9
   idVendor           0x152d JMicron Technology Corp. / JMicron USA 
Technology Corp.
   idProduct          0x9561
   bcdDevice            0.01
   iManufacturer           1 JMicron
   iProduct                2 JMS56x Series
   iSerial                 5 00000000000000000000
   bNumConfigurations      1
   Configuration Descriptor:
     bLength                 9
     bDescriptorType         2
     wTotalLength          121
     bNumInterfaces          1
     bConfigurationValue     1
     iConfiguration          4 USB Mass Storage
     bmAttributes         0xc0
       Self Powered
     MaxPower                2mA
     Interface Descriptor:
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        0
       bAlternateSetting       0
       bNumEndpoints           2
       bInterfaceClass         8 Mass Storage
       bInterfaceSubClass      6 SCSI
       bInterfaceProtocol     80 Bulk-Only
       iInterface              6 MSC Bulk-Only Transfer
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x81  EP 1 IN
         bmAttributes            2
           Transfer Type            Bulk
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0400  1x 1024 bytes
         bInterval               0
         bMaxBurst              15
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x02  EP 2 OUT
         bmAttributes            2
           Transfer Type            Bulk
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0400  1x 1024 bytes
         bInterval               0
         bMaxBurst              15
     Interface Descriptor:
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        0
       bAlternateSetting       1
       bNumEndpoints           4
       bInterfaceClass         8 Mass Storage
       bInterfaceSubClass      6 SCSI
       bInterfaceProtocol     98
       iInterface             10 MSC BOT/UAS Transfer
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x01  EP 1 OUT
         bmAttributes            2
           Transfer Type            Bulk
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0400  1x 1024 bytes
         bInterval               0
         bMaxBurst               0
         Command pipe (0x01)
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x82  EP 2 IN
         bmAttributes            2
           Transfer Type            Bulk
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0400  1x 1024 bytes
         bInterval               0
         bMaxBurst               0
         MaxStreams             32
         Status pipe (0x02)
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x83  EP 3 IN
         bmAttributes            2
           Transfer Type            Bulk
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0400  1x 1024 bytes
         bInterval               0
         bMaxBurst              15
         MaxStreams             32
         Data-in pipe (0x03)
       Endpoint Descriptor:
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x04  EP 4 OUT
         bmAttributes            2
           Transfer Type            Bulk
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0400  1x 1024 bytes
         bInterval               0
         bMaxBurst              15
         MaxStreams             32
         Data-out pipe (0x04)
Binary Object Store Descriptor:
   bLength                 5
   bDescriptorType        15
   wTotalLength           22
   bNumDeviceCaps          2
   USB 2.0 Extension Device Capability:
     bLength                 7
     bDescriptorType        16
     bDevCapabilityType      2
     bmAttributes   0x00000002
       Link Power Management (LPM) Supported
   SuperSpeed USB Device Capability:
     bLength                10
     bDescriptorType        16
     bDevCapabilityType      3
     bmAttributes         0x00
     wSpeedsSupported   0x000e
       Device can operate at Full Speed (12Mbps)
       Device can operate at High Speed (480Mbps)
       Device can operate at SuperSpeed (5Gbps)
     bFunctionalitySupport   1
       Lowest fully-functional device speed is Full Speed (12Mbps)
     bU1DevExitLat          10 micro seconds
     bU2DevExitLat          32 micro seconds
Device Status:     0x0001
   Self Powered
=======================================================================
Connect and disconnect dmesg without uas and usb_storage

[   56.205374] usb 4-1.3: new SuperSpeed USB device number 3 using xhci_hcd
[   56.226152] usb 4-1.3: New USB device found, idVendor=152d, 
idProduct=9561
[   56.233017] usb 4-1.3: New USB device strings: Mfr=1, Product=2, 
SerialNumber=5
[   56.240332] usb 4-1.3: Product: JMS56x Series
[   56.244677] usb 4-1.3: Manufacturer: JMicron
[   56.248945] usb 4-1.3: SerialNumber: 00000000000000000000
[  337.530073] usb 4-1.3: USB disconnect, device number 3

=======================================================================
Here is the dmesg output with the unusual_uas patch applied
[  832.995364] usb 4-1.3: new SuperSpeed USB device number 5 using xhci_hcd
[  833.016186] usb 4-1.3: New USB device found, idVendor=152d, 
idProduct=9561
[  833.023051] usb 4-1.3: New USB device strings: Mfr=1, Product=2, 
SerialNumber=5
[  833.030365] usb 4-1.3: Product: JMS56x Series
[  833.034710] usb 4-1.3: Manufacturer: JMicron
[  833.038977] usb 4-1.3: SerialNumber: 00000000000000000000
[  833.045767] scsi host5: uas
[  833.049191] scsi 5:0:0:0: Direct-Access     ST4000NM 0033-9ZM170 
  0001 PQ: 0 ANSI: 6
[  833.058454] sd 5:0:0:0: Attached scsi generic sg1 type 0
[  833.063792] sd 5:0:0:0: [sdb] 7814037168 512-byte logical blocks: 
(4.00 TB/3.63 TiB)
[  833.072483] sd 5:0:0:0: [sdb] Write Protect is off
[  833.077277] sd 5:0:0:0: [sdb] Mode Sense: 67 00 10 08
[  833.077678] sd 5:0:0:0: [sdb] Write cache: enabled, read cache: 
enabled, supports DPO and FUA
[  833.144571]  sdb: sdb1
[  833.149095] sd 5:0:0:0: [sdb] Attached SCSI disk
[  843.149653] scsi host5: uas_post_reset: alloc streams error -19 after 
reset
[  843.157268] sd 5:0:0:0: [sdb] Synchronizing SCSI cache

========================================================================

>
> Regards,
>
> Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alan Stern Dec. 22, 2016, 10:44 p.m. UTC | #5
On Wed, 21 Dec 2016, George Cherian wrote:

> Hi Oliver,
> 
> I was working with this JMicron device and using the uas driver.
> I am seeing the following 2 issues.
> 
> 1) On connect I see the following messages.
> xhci_hcd 0000:00:11.0: ERROR Transfer event for disabled endpoint or 
> incorrect stream ring
>   This was eliminated using the following scissor patch.
> 
> ---------------------------------8<------------------------------------
> [PATCH] usb: storage: unusual_uas: Add JMicron JMS56x to unusual device
> 
> This device gives the following error on detection.
> xhci_hcd 0000:00:11.0: ERROR Transfer event for disabled endpoint or 
> incorrect stream ring
> 
> The same error is not seen when it is added to unusual_device
> list with US_FL_NO_REPORT_OPCODES passed.
> 
> Signed-off-by: George Cherian <george.cherian@cavium.com>
> ---
>   drivers/usb/storage/unusual_uas.h | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/usb/storage/unusual_uas.h 
> b/drivers/usb/storage/unusual_uas.h
> index cbea9f3..d292299 100644
> --- a/drivers/usb/storage/unusual_uas.h
> +++ b/drivers/usb/storage/unusual_uas.h
> @@ -142,6 +142,13 @@ UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999,
>   		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
>   		US_FL_BROKEN_FUA | US_FL_NO_REPORT_OPCODES),
> 
> +/* Reported-by George Cherian <george.cherian@cavium.com> */
> +UNUSUAL_DEV(0x152d, 0x9561, 0x0000, 0x9999,
> +                "JMicron",
> +                "JMS56x",
> +                USB_SC_DEVICE, USB_PR_DEVICE, NULL,
> +                US_FL_NO_REPORT_OPCODES),
> +
>   /* Reported-by: Hans de Goede <hdegoede@redhat.com> */
>   UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999,
>   		"VIA",
> --------------------------------->8------------------------------------

I don't see how this patch fixes anything.  Unless I'm mistaken, it
just avoids the problem by preventing the system from issuing the
command that provokes the error, rather than really fixing the
underlying error.

> 2) On disconnect I am seeing the following issue
> 
>   scsi host4: uas_post_reset: alloc streams error -19 after reset
>   sd 4:0:0:0: [sdb] Synchronizing SCSI cache
> 
> This is more fatal because after these messages the USB port becomes 
> unusable. Even an lsusb invocation hangs for ever.

This problem looks pretty simple.  uas doesn't check properly to see if 
the device was disconnected following a reset.

Try changing the line in uas_post_reset() that says:

	if (devinfo->shutdown)

to:

	if (devinfo->shutdown ||
			devinfo->udev->state == USB_STATE_NOTATTACHED)

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Oliver Neukum Dec. 27, 2016, 2:34 p.m. UTC | #6
On Thu, 2016-12-22 at 17:44 -0500, Alan Stern wrote:
> I don't see how this patch fixes anything.  Unless I'm mistaken, it
> just avoids the problem by preventing the system from issuing the
> command that provokes the error, rather than really fixing the
> underlying error.

Please clarify. If a reset leads to a disconnect, isn't that
exactly what we want?

	Regards
		Oliver

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alan Stern Dec. 27, 2016, 3:20 p.m. UTC | #7
On Tue, 27 Dec 2016, Oliver Neukum wrote:

> On Thu, 2016-12-22 at 17:44 -0500, Alan Stern wrote:
> > I don't see how this patch fixes anything.  Unless I'm mistaken, it
> > just avoids the problem by preventing the system from issuing the
> > command that provokes the error, rather than really fixing the
> > underlying error.
> 
> Please clarify. If a reset leads to a disconnect, isn't that
> exactly what we want?

I didn't express myself clearly enough.  Yes, if a reset leads to a 
disconnect then avoiding the reset will avoid problems.

But the _real_ error here is that xhci-hcd says "ERROR Transfer event
for disabled endpoint or incorrect stream ring" when the disconnect 
occurs during reset.  That shouldn't happen, no matter what quirks the 
device has.  It indicates a bug either in uas or in xhci-hcd.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Oliver Neukum Dec. 27, 2016, 3:53 p.m. UTC | #8
On Tue, 2016-12-27 at 10:20 -0500, Alan Stern wrote:
> On Tue, 27 Dec 2016, Oliver Neukum wrote:
> 
> > On Thu, 2016-12-22 at 17:44 -0500, Alan Stern wrote:
> > > I don't see how this patch fixes anything.  Unless I'm mistaken, it
> > > just avoids the problem by preventing the system from issuing the
> > > command that provokes the error, rather than really fixing the
> > > underlying error.
> > 
> > Please clarify. If a reset leads to a disconnect, isn't that
> > exactly what we want?
> 
> I didn't express myself clearly enough.  Yes, if a reset leads to a 
> disconnect then avoiding the reset will avoid problems.

Good. Then we need to clarify whether the device was physically
disconnected when the logs were taken.

> But the _real_ error here is that xhci-hcd says "ERROR Transfer event
> for disabled endpoint or incorrect stream ring" when the disconnect 
> occurs during reset.  That shouldn't happen, no matter what quirks the 
> device has.  It indicates a bug either in uas or in xhci-hcd.

True. I am afraid that there necessarily is a window for resetting a
disconnected device. But the check you proposed is better.
however, I'd like to encapsulate that together with a test for
logical disconnect. Uas is unlikely to be the only driver that has
this issue.

	Regards
		Oliver




--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
George Cherian Dec. 27, 2016, 6:22 p.m. UTC | #9
Hi Alan,


On Tuesday 27 December 2016 08:50 PM, Alan Stern wrote:
> On Tue, 27 Dec 2016, Oliver Neukum wrote:
>
>> On Thu, 2016-12-22 at 17:44 -0500, Alan Stern wrote:
>>> I don't see how this patch fixes anything.  Unless I'm mistaken, it
>>> just avoids the problem by preventing the system from issuing the
>>> command that provokes the error, rather than really fixing the
>>> underlying error.
>> Please clarify. If a reset leads to a disconnect, isn't that
>> exactly what we want?
> I didn't express myself clearly enough.  Yes, if a reset leads to a
> disconnect then avoiding the reset will avoid problems.
>
> But the _real_ error here is that xhci-hcd says "ERROR Transfer event
> for disabled endpoint or incorrect stream ring" when the disconnect
> occurs during reset.
I think there is some misunderstanding of the issues.

"ERROR Transfer event for disabled endpoint or incorrect stream ring" This particular message is during the connect of the device and not during the disconnect.
To avoid this message the unusual_uas.h patch was sent earlier.

During disconnect of the device I get   "scsi host4: uas_post_reset: alloc streams error -19 after reset" and 
I dont get the same with the modified patch which Alan suggested, 
instead I get a proper disconnect.

> That shouldn't happen, no matter what quirks the
> device has.  It indicates a bug either in uas or in xhci-hcd.
>
> Alan Stern
>
Regards, -George
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alan Stern Dec. 28, 2016, 2:19 a.m. UTC | #10
On Tue, 27 Dec 2016, George Cherian wrote:

> Hi Alan,
> 
> 
> On Tuesday 27 December 2016 08:50 PM, Alan Stern wrote:
> > On Tue, 27 Dec 2016, Oliver Neukum wrote:
> >
> >> On Thu, 2016-12-22 at 17:44 -0500, Alan Stern wrote:
> >>> I don't see how this patch fixes anything.  Unless I'm mistaken, it
> >>> just avoids the problem by preventing the system from issuing the
> >>> command that provokes the error, rather than really fixing the
> >>> underlying error.
> >> Please clarify. If a reset leads to a disconnect, isn't that
> >> exactly what we want?
> > I didn't express myself clearly enough.  Yes, if a reset leads to a
> > disconnect then avoiding the reset will avoid problems.
> >
> > But the _real_ error here is that xhci-hcd says "ERROR Transfer event
> > for disabled endpoint or incorrect stream ring" when the disconnect
> > occurs during reset.
> I think there is some misunderstanding of the issues.
> 
> "ERROR Transfer event for disabled endpoint or incorrect stream ring"
> This particular message is during the connect of the device and not
> during the disconnect.
> To avoid this message the unusual_uas.h patch was sent earlier.

Right -- the patch _avoids_ the message.  But it doesn't fix the actual 
error/bug that caused to message to be logged in the first place.

> During disconnect of the device I get   "scsi host4: uas_post_reset: alloc streams error -19 after reset" and 
> I dont get the same with the modified patch which Alan suggested, 
> instead I get a proper disconnect.

Good.


On Tue, 27 Dec 2016, Oliver Neukum wrote:

> On Tue, 2016-12-27 at 10:20 -0500, Alan Stern wrote:
> > On Tue, 27 Dec 2016, Oliver Neukum wrote:
> > 
> > > On Thu, 2016-12-22 at 17:44 -0500, Alan Stern wrote:
> > > > I don't see how this patch fixes anything.  Unless I'm mistaken, it
> > > > just avoids the problem by preventing the system from issuing the
> > > > command that provokes the error, rather than really fixing the
> > > > underlying error.
> > > 
> > > Please clarify. If a reset leads to a disconnect, isn't that
> > > exactly what we want?
> > 
> > I didn't express myself clearly enough.  Yes, if a reset leads to a 
> > disconnect then avoiding the reset will avoid problems.
> 
> Good. Then we need to clarify whether the device was physically
> disconnected when the logs were taken.

According to George, it was connected when the first error message 
occurred and physically disconnected when the second message occurred.

> > But the _real_ error here is that xhci-hcd says "ERROR Transfer event
> > for disabled endpoint or incorrect stream ring" when the disconnect 
> > occurs during reset.  That shouldn't happen, no matter what quirks the 
> > device has.  It indicates a bug either in uas or in xhci-hcd.
> 
> True. I am afraid that there necessarily is a window for resetting a
> disconnected device. But the check you proposed is better.
> however, I'd like to encapsulate that together with a test for
> logical disconnect. Uas is unlikely to be the only driver that has
> this issue.

True enough.  We could have a usb_device_is_disconnected() inline
helper for this purpose.  There's no need to try to distinguish 
between physical and logical disconnects, as far as I can see.

However, as George points out, the "Transfer event" error has nothing 
to do with disconnection.  It was triggered by the device's bogus 
response to a REPORT OPCODES command, or something of the sort.  We 
should be able to handle bogus responses without logging ERROR 
messages, because such messages indicate a bug in a kernel driver.

Alan Stern


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Oliver Neukum Dec. 29, 2016, 8:28 a.m. UTC | #11
On Tue, 2016-12-27 at 21:19 -0500, Alan Stern wrote:
> On Tue, 27 Dec 2016, George Cherian wrote:

> > True. I am afraid that there necessarily is a window for resetting a
> > disconnected device. But the check you proposed is better.
> > however, I'd like to encapsulate that together with a test for
> > logical disconnect. Uas is unlikely to be the only driver that has
> > this issue.
> 
> True enough.  We could have a usb_device_is_disconnected() inline
> helper for this purpose.  There's no need to try to distinguish 
> between physical and logical disconnects, as far as I can see.

There is no such need. There is a need for both checks though.

> However, as George points out, the "Transfer event" error has nothing 
> to do with disconnection.  It was triggered by the device's bogus 
> response to a REPORT OPCODES command, or something of the sort.  We 
> should be able to handle bogus responses without logging ERROR 
> messages, because such messages indicate a bug in a kernel driver.

Indeed. We have two independent issues. We should have two independent
fixes.

	Regards
		Oliver



--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/drivers/usb/storage/unusual_uas.h 
b/drivers/usb/storage/unusual_uas.h
index cbea9f3..d292299 100644
--- a/drivers/usb/storage/unusual_uas.h
+++ b/drivers/usb/storage/unusual_uas.h
@@ -142,6 +142,13 @@  UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999,
  		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
  		US_FL_BROKEN_FUA | US_FL_NO_REPORT_OPCODES),

+/* Reported-by George Cherian <george.cherian@cavium.com> */
+UNUSUAL_DEV(0x152d, 0x9561, 0x0000, 0x9999,
+                "JMicron",
+                "JMS56x",
+                USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+                US_FL_NO_REPORT_OPCODES),
+
  /* Reported-by: Hans de Goede <hdegoede@redhat.com> */
  UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999,
  		"VIA",