All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB:fix USB3 devices behind USB3 hubs not resuming at hibernate thaw
@ 2018-03-21  5:29 ` Zhengjun Xing
  0 siblings, 0 replies; 6+ messages in thread
From: Zhengjun Xing @ 2018-03-21  5:29 UTC (permalink / raw)
  To: gregkh; +Cc: stern, mathias.nyman, linux-usb, linux-kernel, Zhengjun Xing

USB3 hubs don't support global suspend.

USB3 specification 10.10, Enhanced SuperSpeed hubs only support selective
suspend and resume, they do not support global suspend/resume where the
hub downstream facing ports states are not affected.

When system enters hibernation it first enters freeze process where only
the root hub enters suspend, usb_port_suspend() is not called for other
devices, and suspend status flags are not set for them. Other devices are
expected to suspend globally. Some external USB3 hubs will suspend the
downstream facing port at global suspend. These devices won't be resumed
at thaw as the suspend status flag is not set.

A USB3 removable hard disk connected through a USB3 hub that won't resume
at thaw will fail to synchronize SCSI cache, return “cmd cmplt err -71”
error, and needs a 60 seconds timeout which causing system hang for 60s
before the USB host reset the port for the USB3 removable hard disk to
recover.

Fix this by always calling usb_port_suspend() during freeze for USB3
devices.

Signed-off-by: Zhengjun Xing <zhengjun.xing@linux.intel.com>
Cc: stable <stable@vger.kernel.org>
---
 drivers/usb/core/generic.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c
index 83c14dda6300..bc8242bc4564 100644
--- a/drivers/usb/core/generic.c
+++ b/drivers/usb/core/generic.c
@@ -210,8 +210,13 @@ static int generic_suspend(struct usb_device *udev, pm_message_t msg)
 	if (!udev->parent)
 		rc = hcd_bus_suspend(udev, msg);
 
-	/* Non-root devices don't need to do anything for FREEZE or PRETHAW */
-	else if (msg.event == PM_EVENT_FREEZE || msg.event == PM_EVENT_PRETHAW)
+	/*
+	 * Non-root USB2 devices don't need to do anything for FREEZE
+	 * or PRETHAW. USB3 devices don't support global suspend and
+	 * needs to be selectively suspended.
+	 */
+	else if ((msg.event == PM_EVENT_FREEZE || msg.event == PM_EVENT_PRETHAW)
+		 && (udev->speed < USB_SPEED_SUPER))
 		rc = 0;
 	else
 		rc = usb_port_suspend(udev, msg);
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* USB:fix USB3 devices behind USB3 hubs not resuming at hibernate thaw
@ 2018-03-21  5:29 ` Zhengjun Xing
  0 siblings, 0 replies; 6+ messages in thread
From: Zhengjun Xing @ 2018-03-21  5:29 UTC (permalink / raw)
  To: gregkh; +Cc: stern, mathias.nyman, linux-usb, linux-kernel, Zhengjun Xing

USB3 hubs don't support global suspend.

USB3 specification 10.10, Enhanced SuperSpeed hubs only support selective
suspend and resume, they do not support global suspend/resume where the
hub downstream facing ports states are not affected.

When system enters hibernation it first enters freeze process where only
the root hub enters suspend, usb_port_suspend() is not called for other
devices, and suspend status flags are not set for them. Other devices are
expected to suspend globally. Some external USB3 hubs will suspend the
downstream facing port at global suspend. These devices won't be resumed
at thaw as the suspend status flag is not set.

A USB3 removable hard disk connected through a USB3 hub that won't resume
at thaw will fail to synchronize SCSI cache, return “cmd cmplt err -71”
error, and needs a 60 seconds timeout which causing system hang for 60s
before the USB host reset the port for the USB3 removable hard disk to
recover.

Fix this by always calling usb_port_suspend() during freeze for USB3
devices.

Signed-off-by: Zhengjun Xing <zhengjun.xing@linux.intel.com>
---
 drivers/usb/core/generic.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c
index 83c14dda6300..bc8242bc4564 100644
--- a/drivers/usb/core/generic.c
+++ b/drivers/usb/core/generic.c
@@ -210,8 +210,13 @@ static int generic_suspend(struct usb_device *udev, pm_message_t msg)
 	if (!udev->parent)
 		rc = hcd_bus_suspend(udev, msg);
 
-	/* Non-root devices don't need to do anything for FREEZE or PRETHAW */
-	else if (msg.event == PM_EVENT_FREEZE || msg.event == PM_EVENT_PRETHAW)
+	/*
+	 * Non-root USB2 devices don't need to do anything for FREEZE
+	 * or PRETHAW. USB3 devices don't support global suspend and
+	 * needs to be selectively suspended.
+	 */
+	else if ((msg.event == PM_EVENT_FREEZE || msg.event == PM_EVENT_PRETHAW)
+		 && (udev->speed < USB_SPEED_SUPER))
 		rc = 0;
 	else
 		rc = usb_port_suspend(udev, msg);

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] USB:fix USB3 devices behind USB3 hubs not resuming at hibernate thaw
@ 2018-03-22 12:03   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2018-03-22 12:03 UTC (permalink / raw)
  To: Zhengjun Xing; +Cc: stern, mathias.nyman, linux-usb, linux-kernel

On Wed, Mar 21, 2018 at 01:29:42PM +0800, Zhengjun Xing wrote:
> USB3 hubs don't support global suspend.
> 
> USB3 specification 10.10, Enhanced SuperSpeed hubs only support selective
> suspend and resume, they do not support global suspend/resume where the
> hub downstream facing ports states are not affected.
> 
> When system enters hibernation it first enters freeze process where only
> the root hub enters suspend, usb_port_suspend() is not called for other
> devices, and suspend status flags are not set for them. Other devices are
> expected to suspend globally. Some external USB3 hubs will suspend the
> downstream facing port at global suspend. These devices won't be resumed
> at thaw as the suspend status flag is not set.
> 
> A USB3 removable hard disk connected through a USB3 hub that won't resume
> at thaw will fail to synchronize SCSI cache, return “cmd cmplt err -71”
> error, and needs a 60 seconds timeout which causing system hang for 60s
> before the USB host reset the port for the USB3 removable hard disk to
> recover.
> 
> Fix this by always calling usb_port_suspend() during freeze for USB3
> devices.

This should go to the stable trees as well, right?

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* USB:fix USB3 devices behind USB3 hubs not resuming at hibernate thaw
@ 2018-03-22 12:03   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2018-03-22 12:03 UTC (permalink / raw)
  To: Zhengjun Xing; +Cc: stern, mathias.nyman, linux-usb, linux-kernel

On Wed, Mar 21, 2018 at 01:29:42PM +0800, Zhengjun Xing wrote:
> USB3 hubs don't support global suspend.
> 
> USB3 specification 10.10, Enhanced SuperSpeed hubs only support selective
> suspend and resume, they do not support global suspend/resume where the
> hub downstream facing ports states are not affected.
> 
> When system enters hibernation it first enters freeze process where only
> the root hub enters suspend, usb_port_suspend() is not called for other
> devices, and suspend status flags are not set for them. Other devices are
> expected to suspend globally. Some external USB3 hubs will suspend the
> downstream facing port at global suspend. These devices won't be resumed
> at thaw as the suspend status flag is not set.
> 
> A USB3 removable hard disk connected through a USB3 hub that won't resume
> at thaw will fail to synchronize SCSI cache, return “cmd cmplt err -71”
> error, and needs a 60 seconds timeout which causing system hang for 60s
> before the USB host reset the port for the USB3 removable hard disk to
> recover.
> 
> Fix this by always calling usb_port_suspend() during freeze for USB3
> devices.

This should go to the stable trees as well, right?

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] USB:fix USB3 devices behind USB3 hubs not resuming at hibernate thaw
@ 2018-03-23  0:49     ` Zhengjun Xing
  0 siblings, 0 replies; 6+ messages in thread
From: Xing Zhengjun @ 2018-03-23  0:49 UTC (permalink / raw)
  To: Greg KH; +Cc: stern, mathias.nyman, linux-usb, linux-kernel



On 3/22/2018 8:03 PM, Greg KH wrote:
> On Wed, Mar 21, 2018 at 01:29:42PM +0800, Zhengjun Xing wrote:
>> USB3 hubs don't support global suspend.
>>
>> USB3 specification 10.10, Enhanced SuperSpeed hubs only support selective
>> suspend and resume, they do not support global suspend/resume where the
>> hub downstream facing ports states are not affected.
>>
>> When system enters hibernation it first enters freeze process where only
>> the root hub enters suspend, usb_port_suspend() is not called for other
>> devices, and suspend status flags are not set for them. Other devices are
>> expected to suspend globally. Some external USB3 hubs will suspend the
>> downstream facing port at global suspend. These devices won't be resumed
>> at thaw as the suspend status flag is not set.
>>
>> A USB3 removable hard disk connected through a USB3 hub that won't resume
>> at thaw will fail to synchronize SCSI cache, return “cmd cmplt err -71”
>> error, and needs a 60 seconds timeout which causing system hang for 60s
>> before the USB host reset the port for the USB3 removable hard disk to
>> recover.
>>
>> Fix this by always calling usb_port_suspend() during freeze for USB3
>> devices.
> This should go to the stable trees as well, right?
>
> greg k-h
   Yes. It should go to the stable trees.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* USB:fix USB3 devices behind USB3 hubs not resuming at hibernate thaw
@ 2018-03-23  0:49     ` Zhengjun Xing
  0 siblings, 0 replies; 6+ messages in thread
From: Zhengjun Xing @ 2018-03-23  0:49 UTC (permalink / raw)
  To: Greg KH; +Cc: stern, mathias.nyman, linux-usb, linux-kernel

On 3/22/2018 8:03 PM, Greg KH wrote:
> On Wed, Mar 21, 2018 at 01:29:42PM +0800, Zhengjun Xing wrote:
>> USB3 hubs don't support global suspend.
>>
>> USB3 specification 10.10, Enhanced SuperSpeed hubs only support selective
>> suspend and resume, they do not support global suspend/resume where the
>> hub downstream facing ports states are not affected.
>>
>> When system enters hibernation it first enters freeze process where only
>> the root hub enters suspend, usb_port_suspend() is not called for other
>> devices, and suspend status flags are not set for them. Other devices are
>> expected to suspend globally. Some external USB3 hubs will suspend the
>> downstream facing port at global suspend. These devices won't be resumed
>> at thaw as the suspend status flag is not set.
>>
>> A USB3 removable hard disk connected through a USB3 hub that won't resume
>> at thaw will fail to synchronize SCSI cache, return “cmd cmplt err -71”
>> error, and needs a 60 seconds timeout which causing system hang for 60s
>> before the USB host reset the port for the USB3 removable hard disk to
>> recover.
>>
>> Fix this by always calling usb_port_suspend() during freeze for USB3
>> devices.
> This should go to the stable trees as well, right?
>
> greg k-h
   Yes. It should go to the stable trees.
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-03-23  0:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-21  5:29 [PATCH] USB:fix USB3 devices behind USB3 hubs not resuming at hibernate thaw Zhengjun Xing
2018-03-21  5:29 ` Zhengjun Xing
2018-03-22 12:03 ` [PATCH] " Greg KH
2018-03-22 12:03   ` Greg Kroah-Hartman
2018-03-23  0:49   ` [PATCH] " Xing Zhengjun
2018-03-23  0:49     ` Zhengjun Xing

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.