Re: JMS56x not working reliably with uas driver

2016-12-29 Thread Oliver Neukum
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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: JMS56x not working reliably with uas driver

2016-12-27 Thread Alan Stern
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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: JMS56x not working reliably with uas driver

2016-12-27 Thread George Cherian

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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: JMS56x not working reliably with uas driver

2016-12-27 Thread Oliver Neukum
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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: JMS56x not working reliably with uas driver

2016-12-27 Thread Alan Stern
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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: JMS56x not working reliably with uas driver

2016-12-27 Thread Oliver Neukum
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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: JMS56x not working reliably with uas driver

2016-12-23 Thread Alan Stern
On Fri, 23 Dec 2016, George Cherian wrote:

> >> 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)
> Yes this works for me but with a little bit change as follows, But am 
> not sure whether we should goto reset_scsi in case of shutdown.
> Please advice.
> 
> diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
> index 5ef014b..24db3fd 100644
> --- a/drivers/usb/storage/uas.c
> +++ b/drivers/usb/storage/uas.c
> @@ -1072,8 +1072,8 @@ static int uas_post_reset(struct usb_interface *intf)
>  unsigned long flags;
>  int err;
> 
> -   if (devinfo->shutdown)
> -   return 0;
> +   if (devinfo->shutdown || devinfo->udev->state == 
> USB_STATE_NOTATTACHED)
> +   goto reset_scsi;
> 
>  err = uas_configure_endpoints(devinfo);
>  if (err) {
> @@ -1083,6 +1083,7 @@ static int uas_post_reset(struct usb_interface *intf)
>  return 1;
>  }
> 
> +reset_scsi:
>  spin_lock_irqsave(shost->host_lock, flags);
>  scsi_report_bus_reset(shost, 0);
>  spin_unlock_irqrestore(shost->host_lock, flags);

As far as I can tell, adding the "goto reset_scsi" line does not help 
at all.  There's no reason to report that the bus has been reset after 
the device is gone.

Alan Stern

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


Re: JMS56x not working reliably with uas driver

2016-12-22 Thread George Cherian

Hi Alan,


On Friday 23 December 2016 04:14 AM, Alan Stern wrote:

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 :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 :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 
---
   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, 0x, 0x,
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
US_FL_BROKEN_FUA | US_FL_NO_REPORT_OPCODES),

+/* Reported-by George Cherian  */
+UNUSUAL_DEV(0x152d, 0x9561, 0x, 0x,
+"JMicron",
+"JMS56x",
+USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+US_FL_NO_REPORT_OPCODES),
+
   /* Reported-by: Hans de Goede  */
   UNUSUAL_DEV(0x2109, 0x0711, 0x, 0x,
"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)
Yes this works for me but with a little bit change as follows, But am 
not sure whether we should goto reset_scsi in case of shutdown.

Please advice.

diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 5ef014b..24db3fd 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -1072,8 +1072,8 @@ static int uas_post_reset(struct usb_interface *intf)
unsigned long flags;
int err;

-   if (devinfo->shutdown)
-   return 0;
+   if (devinfo->shutdown || devinfo->udev->state == 
USB_STATE_NOTATTACHED)

+   goto reset_scsi;

err = uas_configure_endpoints(devinfo);
if (err) {
@@ -1083,6 +1083,7 @@ static int uas_post_reset(struct usb_interface *intf)
return 1;
}

+reset_scsi:
spin_lock_irqsave(shost->host_lock, flags);
scsi_report_bus_reset(shost, 0);
spin_unlock_irqrestore(shost->host_lock, flags);


Alan Stern



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


Re: JMS56x not working reliably with uas driver

2016-12-22 Thread Alan Stern
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 :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 :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 
> ---
>   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, 0x, 0x,
>   USB_SC_DEVICE, USB_PR_DEVICE, NULL,
>   US_FL_BROKEN_FUA | US_FL_NO_REPORT_OPCODES),
> 
> +/* Reported-by George Cherian  */
> +UNUSUAL_DEV(0x152d, 0x9561, 0x, 0x,
> +"JMicron",
> +"JMS56x",
> +USB_SC_DEVICE, USB_PR_DEVICE, NULL,
> +US_FL_NO_REPORT_OPCODES),
> +
>   /* Reported-by: Hans de Goede  */
>   UNUSUAL_DEV(0x2109, 0x0711, 0x, 0x,
>   "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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: JMS56x not working reliably with uas driver

2016-12-22 Thread Oliver Neukum
On Thu, 2016-12-22 at 15:43 +0530, George Cherian wrote:
> dmesg with the patch applied

Hi,

did you apply both patches, yours and the one I posted?
And did you physically disconnect your device?

Regards
Oliver


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


Re: JMS56x not working reliably with uas driver

2016-12-22 Thread George Cherian

dmesg with the patch applied

[root@localhost ~]# dmesg
[  108.575683] usb 4-1.3: new SuperSpeed USB device number 3 using xhci_hcd
[  108.596485] usb 4-1.3: New USB device found, idVendor=152d, 
idProduct=9561
[  108.603350] usb 4-1.3: New USB device strings: Mfr=1, Product=2, 
SerialNumber=5

[  108.610663] usb 4-1.3: Product: JMS56x Series
[  108.615009] usb 4-1.3: Manufacturer: JMicron
[  108.619277] usb 4-1.3: SerialNumber: 
[  109.790747] usbcore: registered new interface driver usb-storage
[  110.061769] scsi host4: scsi_eh_4: sleeping
[  110.062119] scsi host4: uas
[  110.062305] usbcore: registered new interface driver uas
[  110.062370] scsi 4:0:0:0: Send: scmd 0x801fddcc1500
[  110.062374] scsi 4:0:0:0: CDB: Inquiry 12 00 00 00 24 00
[  110.062551] scsi 4:0:0:0: Done: SUCCESS Result: hostbyte=DID_OK 
driverbyte=DRIVER_OK

[  110.062555] scsi 4:0:0:0: CDB: Inquiry 12 00 00 00 24 00
[  110.062559] scsi 4:0:0:0: 0 sectors total, 36 bytes done.
[  110.062615] scsi 4:0:0:0: Send: scmd 0x801fcc338880
[  110.062618] scsi 4:0:0:0: CDB: Inquiry 12 00 00 00 60 00
[  110.062790] scsi 4:0:0:0: Done: SUCCESS Result: hostbyte=DID_OK 
driverbyte=DRIVER_OK

[  110.062793] scsi 4:0:0:0: CDB: Inquiry 12 00 00 00 60 00
[  110.062797] scsi 4:0:0:0: 0 sectors total, 96 bytes done.
[  110.062829] scsi 4:0:0:0: Direct-Access ST4000NM 0033-9ZM170  
0001 PQ: 0 ANSI: 6

[  110.062844] scsi 4:0:0:0: Send: scmd 0x801fcc338880
[  110.062847] scsi 4:0:0:0: CDB: Inquiry 12 01 00 00 ff 00
[  110.063011] scsi 4:0:0:0: Done: SUCCESS Result: hostbyte=DID_OK 
driverbyte=DRIVER_OK

[  110.063014] scsi 4:0:0:0: CDB: Inquiry 12 01 00 00 ff 00
[  110.063018] scsi 4:0:0:0: 0 sectors total, 255 bytes done.
[  110.063045] scsi 4:0:0:0: Send: scmd 0x801fcc338880
[  110.063048] scsi 4:0:0:0: CDB: Inquiry 12 01 80 00 ff 00
[  110.063216] scsi 4:0:0:0: Done: SUCCESS Result: hostbyte=DID_OK 
driverbyte=DRIVER_OK

[  110.063219] scsi 4:0:0:0: CDB: Inquiry 12 01 80 00 ff 00
[  110.063222] scsi 4:0:0:0: 0 sectors total, 255 bytes done.
[  110.063248] scsi 4:0:0:0: Send: scmd 0x801fcc338880
[  110.063251] scsi 4:0:0:0: CDB: Inquiry 12 01 83 00 ff 00
[  110.063428] scsi 4:0:0:0: Done: SUCCESS Result: hostbyte=DID_OK 
driverbyte=DRIVER_OK

[  110.063431] scsi 4:0:0:0: CDB: Inquiry 12 01 83 00 ff 00
[  110.063435] scsi 4:0:0:0: 0 sectors total, 255 bytes done.
[  110.063463] scsi 4:0:0:0: Send: scmd 0x801fcc338880
[  110.063466] scsi 4:0:0:0: CDB: Report luns a0 00 00 00 00 00 00 00 10 
00 00 00
[  110.063626] scsi 4:0:0:0: Done: SUCCESS Result: hostbyte=DID_OK 
driverbyte=DRIVER_OK
[  110.063629] scsi 4:0:0:0: CDB: Report luns a0 00 00 00 00 00 00 00 10 
00 00 00

[  110.063633] scsi 4:0:0:0: 8 sectors total, 4096 bytes done.
[  110.063912] sd 4:0:0:0: Send: scmd 0x801fdd8e5880
[  110.063916] sd 4:0:0:0: CDB: Test Unit Ready 00 00 00 00 00 00
[  110.064018] sd 4:0:0:0: Done: SUCCESS Result: hostbyte=DID_OK 
driverbyte=DRIVER_OK

[  110.064021] sd 4:0:0:0: CDB: Test Unit Ready 00 00 00 00 00 00
[  110.064026] sd 4:0:0:0: 0 sectors total, 0 bytes done.
[  110.064050] sd 4:0:0:0: Send: scmd 0x801fdd8e5a00
[  110.064053] sd 4:0:0:0: CDB: Read capacity(16) 9e 10 00 00 00 00 00 
00 00 00 00 00 00 20 00 00

[  110.064064] sd 4:0:0:0: Attached scsi generic sg1 type 0
[  110.064209] sd 4:0:0:0: Done: SUCCESS Result: hostbyte=DID_OK 
driverbyte=DRIVER_OK
[  110.064213] sd 4:0:0:0: CDB: Read capacity(16) 9e 10 00 00 00 00 00 
00 00 00 00 00 00 20 00 00

[  110.064216] sd 4:0:0:0: 0 sectors total, 32 bytes done.
[  110.064240] sd 4:0:0:0: [sdb] 7814037168 512-byte logical blocks: 
(4.00 TB/3.63 TiB)

[  110.064253] sd 4:0:0:0: Send: scmd 0x801fcc338880
[  110.064256] sd 4:0:0:0: CDB: Inquiry 12 01 00 00 40 00
[  110.064421] sd 4:0:0:0: Done: SUCCESS Result: hostbyte=DID_OK 
driverbyte=DRIVER_OK

[  110.064424] sd 4:0:0:0: CDB: Inquiry 12 01 00 00 40 00
[  110.064427] sd 4:0:0:0: 0 sectors total, 64 bytes done.
[  110.064454] sd 4:0:0:0: Send: scmd 0x801fcc338880
[  110.064457] sd 4:0:0:0: CDB: Inquiry 12 01 b0 00 40 00
[  110.064625] sd 4:0:0:0: Done: SUCCESS Result: hostbyte=DID_OK 
driverbyte=DRIVER_OK

[  110.064628] sd 4:0:0:0: CDB: Inquiry 12 01 b0 00 40 00
[  110.064632] sd 4:0:0:0: 0 sectors total, 64 bytes done.
[  110.064658] sd 4:0:0:0: Send: scmd 0x801fcc338880
[  110.064661] sd 4:0:0:0: CDB: Inquiry 12 01 00 00 40 00
[  110.064829] sd 4:0:0:0: Done: SUCCESS Result: hostbyte=DID_OK 
driverbyte=DRIVER_OK

[  110.064832] sd 4:0:0:0: CDB: Inquiry 12 01 00 00 40 00
[  110.064836] sd 4:0:0:0: 0 sectors total, 64 bytes done.
[  110.064861] sd 4:0:0:0: Send: scmd 0x801fcc338880
[  110.064864] sd 4:0:0:0: CDB: Inquiry 12 01 b1 00 40 00
[  110.065030] sd 4:0:0:0: Done: SUCCESS Result: hostbyte=DID_OK 
driverbyte=DRIVER_OK

[  110.065033] sd 4:0:0:0: CDB: Inquiry 12 01 b1 00 40 00
[  110.065037] sd 4:0:0:0: 0 sectors total, 64 bytes done.
[  110.065064] sd 4:0:0:0: Send: scmd 

Re: JMS56x not working reliably with uas driver

2016-12-21 Thread George Cherian

Hi Oliver,

I will try it out and update you!!


Regards,

-George

On Wednesday 21 December 2016 08:09 PM, Oliver Neukum wrote:

On Wed, 2016-12-21 at 18:17 +0530, George Cherian wrote:

[  843.149653] scsi host5: uas_post_reset: alloc streams error -19
after
reset

That would mean the endpoints are gone. Which is odd.


[  843.157268] sd 5:0:0:0: [sdb] Synchronizing SCSI cache

Could you try the attached patch and do a SCSI log of the enumeration?

Regards
Oliver



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


Re: JMS56x not working reliably with uas driver

2016-12-21 Thread Oliver Neukum
On Wed, 2016-12-21 at 18:17 +0530, George Cherian wrote:
> [  843.149653] scsi host5: uas_post_reset: alloc streams error -19
> after 
> reset

That would mean the endpoints are gone. Which is odd.

> [  843.157268] sd 5:0:0:0: [sdb] Synchronizing SCSI cache

Could you try the attached patch and do a SCSI log of the enumeration?

Regards
Oliver

From d4ddac88bbf9cb15e7d8638582f96d31e245f15b Mon Sep 17 00:00:00 2001
From: Oliver Neukum 
Date: Wed, 21 Dec 2016 15:34:54 +0100
Subject: [PATCH] uas: device crashes on reset

We avoid resetting it.

Signed-off-by: Oliver Neukum 
---
 drivers/usb/core/quirks.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index d2e50a2..52483fb 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -194,6 +194,8 @@ static const struct usb_device_id usb_quirk_list[] = {
 	{ USB_DEVICE(0x1532, 0x0116), .driver_info =
 			USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL },
 
+	{ USB_DEVICE(0x152d, 0x9561), .driver_info = USB_QUIRK_RESET },
+
 	/* BUILDWIN Photo Frame */
 	{ USB_DEVICE(0x1908, 0x1315), .driver_info =
 			USB_QUIRK_HONOR_BNUMINTERFACES },
-- 
2.1.4



Re: JMS56x not working reliably with uas driver

2016-12-21 Thread George Cherian



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: 
[  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 :00:11.0: ERROR Transfer event for disabled 
endpoint or incorrect stream ring
[  203.631904] xhci_hcd :00:11.0: @001f610a1c10  
 1b00 03078001 state 14 ep_info 9403

[  203.631906] xhci_hcd :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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: JMS56x not working reliably with uas driver

2016-12-21 Thread George Cherian



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: 
[  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 :00:11.0: ERROR Transfer event for
disabled endpoint or incorrect stream ring
[  203.631904] xhci_hcd :00:11.0: @001f610a1c10 
 1b00 03078001 state 14 ep_info 9403
[  203.631906] xhci_hcd :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:
  bLength18
  bDescriptorType 1
  bcdUSB   3.00
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize0 9
  idVendor   0x152d JMicron Technology Corp. / JMicron USA 
Technology Corp.

  idProduct  0x9561
  bcdDevice0.01
  iManufacturer   1 JMicron
  iProduct2 JMS56x Series
  iSerial 5 
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength  121
bNumInterfaces  1
bConfigurationValue 1
iConfiguration  4 USB Mass Storage
bmAttributes 0xc0
  Self Powered
MaxPower2mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   2
  bInterfaceClass 8 Mass 

Re: JMS56x not working reliably with uas driver

2016-12-21 Thread Hans de Goede

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: 
[  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 :00:11.0: ERROR Transfer event for disabled 
endpoint or incorrect stream ring
[  203.631904] xhci_hcd :00:11.0: @001f610a1c10   
1b00 03078001 state 14 ep_info 9403
[  203.631906] xhci_hcd :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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: JMS56x not working reliably with uas driver

2016-12-21 Thread Oliver Neukum
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: 
> [  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 :00:11.0: ERROR Transfer event for disabled 
> endpoint or incorrect stream ring
> [  203.631904] xhci_hcd :00:11.0: @001f610a1c10  
>  1b00 03078001 state 14 ep_info 9403
> [  203.631906] xhci_hcd :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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


JMS56x not working reliably with uas driver

2016-12-21 Thread George Cherian

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 :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 :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 
---
 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, 0x, 0x,
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
US_FL_BROKEN_FUA | US_FL_NO_REPORT_OPCODES),

+/* Reported-by George Cherian  */
+UNUSUAL_DEV(0x152d, 0x9561, 0x, 0x,
+"JMicron",
+"JMS56x",
+USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+US_FL_NO_REPORT_OPCODES),
+
 /* Reported-by: Hans de Goede  */
 UNUSUAL_DEV(0x2109, 0x0711, 0x, 0x,
"VIA",
->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
801f5efb8a00 57530621 C Ii:4:002:1 0:128 1 = 08
801f5efb8a00 57530654 S Ii:4:002:1 -115:128 2 <
801f61285a00 57530677 S Ci:4:002:0 s a3 00  0003 0004 4 <
801f61285a00 57531618 C Ci:4:002:0 0 4 = c1024000
801f61285a00 57531634 S Co:4:002:0 s 23 01 0019 0003  0
801f61285a00 57531992 C Co:4:002:0 0 0
801f61285a00 57532225 S Ci:4:002:0 s a3 00  0003 0004 4 <
801f61285a00 57533010 C Ci:4:002:0 0 4 = c102
801f61285a00 57533022 S Co:4:002:0 s 23 03 001c 0003  0
801f61285a00 57533405 C Co:4:002:0 0 0
801f61285a00 57553165 S Ci:4:002:0 s a3 00  0003 0004 4 <
801f61285a00 57554174 C Ci:4:002:0 0 4 = b102
801f61285a00 57573164 S Ci:4:002:0 s a3 00  0003 0004 4 <
801f61285a00 57574064 C Ci:4:002:0 0 4 = b102
801f61285a00 57593169 S Ci:4:002:0 s a3 00  0003 0004 4 <
801f61285a00 57594214 C Ci:4:002:0 0 4 = b102
801f5efb8a00 57642612 C Ii:4:002:1 0:128 1 = 08
801f5efb8a00 57642621 S Ii:4:002:1 -115:128 2 <
801f5efb8a00 57658612 C Ii:4:002:1 0:128 1 = 08
801f5efb8a00 57658618 S Ii:4:002:1 -115:128 2 <
801f5efb8a00 57674611 C Ii:4:002:1 0:128 1 = 08
801f5efb8a00 57674617 S Ii:4:002:1 -115:128 2 <
801f5efb8a00 57690610 C Ii:4:002:1 0:128 1 = 08
801f5efb8a00 57690615 S Ii:4:002:1 -115:128 2 <
801f5efb8a00 57706609 C Ii:4:002:1 0:128 1 = 08
801f5efb8a00 57706615 S Ii:4:002:1 -115:128 2 <
801f5efb8a00 57722609 C Ii:4:002:1 0:128 1 = 08
801f5efb8a00 57722614 S Ii:4:002:1 -115:128 2 <
801f5efb8a00 57738611 C Ii:4:002:1 0:128 1 = 08
801f5efb8a00 57738616 S Ii:4:002:1 -115:128 2 <
801f5efb8a00 57754610 C Ii:4:002:1 0:128 1 = 08
801f5efb8a00 57754615 S Ii:4:002:1 -115:128 2 <
801f5efb8a00 57770607 C Ii:4:002:1 0:128 1 = 08
801f5efb8a00 57770612 S Ii:4:002:1 -115:128 2 <
801f5efb8a00 57786609 C Ii:4:002:1 0:128 1 = 08
801f5efb8a00 57786614 S Ii:4:002:1 -115:128 2 <
801f5efb8a00 57802608 C Ii:4:002:1 0:128 1 = 08
801f5efb8a00 57802613 S Ii:4:002:1 -115:128 2 <
801f61285a00 57803198 S Ci:4:002:0 s a3 00  0003 0004 4 <
801f61285a00 57804109 C Ci:4:002:0 0 4 = a0020100
801f61285a00 57804122 S Co:4:002:0 s 23 01 0014 0003  0
801f61285a00 57804539 C Co:4:002:0 0 0
801f61285a00 57804553 S Co:4:002:0 s 23 01 001d 0003  0
801f61285a00 57804876 C Co:4:002:0 0 0
801f61285a00 57804890 S Co:4:002:0 s 23 01 0019 0003  0
801f61285a00 57805185 C Co:4:002:0 0 0
801f61285a00 57805199 S Co:4:002:0 s 23 01 0010 0003  0
801f61285a00 57805735 C Co:4:002:0 0 0
801f61285a00 57805749 S Ci:4:002:0 s a3 00  0003 0004 4 <
801f61285a00 57806491 C Ci:4:002:0 0 4 = a002
801f61285a00 57806506 S Ci:4:002:0 s a3 00  0003 0004 4 <
801f61285a00 

Re: JMS56x not working reliably with uas driver

2016-12-21 Thread Oliver Neukum
On Wed, 2016-12-21 at 12:54 +0100, Hans de Goede wrote:
> Hi,
> 
> On 21-12-16 12:42, 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.
> >
> >> 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.
> 
> Ah good point, so instead of just seeing a disconnect, something
> is triggering a reset, and then we try to alloc stream on the
> disconnected usb port and that apparently makes the xhci controller
> quite unhappy.

It is problematic because there is a window we cannot avoid.
This needs a full dmesg to say anything more about it.

Regards
Oliver


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


Re: JMS56x not working reliably with uas driver

2016-12-21 Thread Hans de Goede

Hi,

On 21-12-16 12:42, 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.


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.


Ah good point, so instead of just seeing a disconnect, something
is triggering a reset, and then we try to alloc stream on the
disconnected usb port and that apparently makes the xhci controller
quite unhappy.

Regards,

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


Re: JMS56x not working reliably with uas driver

2016-12-21 Thread Hans de Goede

Hi,

On 21-12-16 12:39, 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 :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 :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 
---
 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, 0x, 0x,
 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
 US_FL_BROKEN_FUA | US_FL_NO_REPORT_OPCODES),

+/* Reported-by George Cherian  */
+UNUSUAL_DEV(0x152d, 0x9561, 0x, 0x,
+"JMicron",
+"JMS56x",
+USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+US_FL_NO_REPORT_OPCODES),
+
 /* Reported-by: Hans de Goede  */
 UNUSUAL_DEV(0x2109, 0x0711, 0x, 0x,
 "VIA",
->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.


Are you still seeen this second problem with the first patch applied ? Is this 
after
an actual disconnect, or after the kernel seeing a disconnect without the device
being actually disconnected.

This second problem sounds like it is an issue with your xhci controller. Can 
you
try this on another motherboard (with another xhci controller) ?

Regards,

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


Re: JMS56x not working reliably with uas driver

2016-12-21 Thread Oliver Neukum
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.

> 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?

Regards
Oliver


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