Re: [RFT] usbcore: Bug fix: system can't suspend with USB3.0 device connected to USB3.0 hub

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sarah,

After applied this patch on the top of USB3 hub changes patches in my branch (can also reproduce the original problem), the problem is still existed.

Freezing user space processes ... (elapsed 0.01 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.00 seconds) done.
PM: Preallocating image memory... done (allocated 3924380 pages)
PM: Allocated 15697520 kbytes in 2.53 seconds (6204.55 MB/s)
hub 8-1:1.0: suspend error -16
pm_op(): usb_dev_freeze+0x0/0x20 returns -16
PM: Device 8-1 failed to freeze: error -16
Restarting tasks ... done.

Unfortunately, the latest Linus tree had a regression that prevent hibernate/resume from working even without those patches.

It is now failing to resume every time tried after hibernate.

PM: Starting manual resume from disk
Freezing user space processes ... 
EXT4-fs (dm-0): INFO: recovery required on readonly filesystem
EXT4-fs (dm-0): write access will be enabled during recovery
EXT4-fs (dm-0): recovery complete
EXT4-fs (dm-0): mounted filesystem with ordered data mode. Opts: (null)
(elapsed 0.18 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.
PM: Loading and decompressing image data (301765 pages) ... done
PM: Read 1207060 kbytes in 6.47 seconds (186.56 MB/s)
serial 00:08: disabled

After applied this patch and the rest of Andiry's larger USB 3.0 hub power management patches on the top of linus tree, there is a conflict with patch [5/5] here.

http://marc.info/?l=linux-usb&m=130136847804961&w=2

--- drivers/usb/core/hub.c
+++ drivers/usb/core/hub.c
@@ -2305,7 +2305,13 @@
        }

        /* see 7.1.7.6 */
-       status = set_port_feature(hub->hdev, port1, USB_PORT_FEAT_SUSPEND);
+       if (hub_is_superspeed(hub->hdev))
+               status = set_port_feature(hub->hdev,
+                               port1 | (USB_SS_PORT_LS_U3 << 3),
+                               USB_PORT_FEAT_LINK_STATE);
+       else
+               status = set_port_feature(hub->hdev, port1,
+                                               USB_PORT_FEAT_SUSPEND);
        if (status) {
                dev_dbg(hub->intfdev, "can't suspend port %d, status %d\n",
                                port1, status);


Do you have suggestion on which git tree/branch is the best to test those?

Thanks,
CAI Qian

----- Original Message -----
> From: Andiry Xu <andiry.xu@xxxxxxx>
> 
> This patch clear PORT_POWER when suspend a USB3.0 device behind a
> USB3.0
> external hub, so the system can suspend and resume.
> 
> Note USB3.0 device may not work after system resume and this is a
> temporary
> workaround. The correct fix will be in future patches.
> 
> Signed-off-by: Andiry Xu <andiry.xu@xxxxxxx>
> ---
> 
> Cai,
> 
> Can you please test this patch and confirm that it fixes the issue you
> saw with the second hibernate attempt failing when a USB 3.0 hard
> drive
> was plugged into a USB 3.0 hub? Note that we don't expect the USB 3.0
> hard drive to survive the resume, but an unplug-replug cycle should
> make
> it work, and the system should be able to suspend and resume
> consistently.
> 
> If so, we'll queue this quick fix for 2.6.39, and Andiry's larger USB
> 3.0 hub power management patches will get queued for 2.6.40. Here's a
> link to those patches, if you want to test them also:
> 
> http://marc.info/?l=linux-usb&m=130136755804342&w=2
> 
> Thanks,
> Sarah Sharp
> 
> 
> drivers/usb/core/hub.c | 12 +++++++++++-
> 1 files changed, 11 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 0968157..42160c9 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -2283,7 +2283,17 @@ int usb_port_suspend(struct usb_device *udev,
> pm_message_t msg)
> }
> 
> /* see 7.1.7.6 */
> - status = set_port_feature(hub->hdev, port1, USB_PORT_FEAT_SUSPEND);
> + /* Clear PORT_POWER if it's a USB3.0 device connected to USB 3.0
> + * external hub.
> + * FIXME: this is a temporary workaround to make the system able
> + * to suspend/resume.
> + */
> + if ((hub->hdev->parent != NULL) && hub_is_superspeed(hub->hdev))
> + status = clear_port_feature(hub->hdev, port1,
> + USB_PORT_FEAT_POWER);
> + else
> + status = set_port_feature(hub->hdev, port1,
> + USB_PORT_FEAT_SUSPEND);
> if (status) {
> dev_dbg(hub->intfdev, "can't suspend port %d, status %d\n",
> port1, status);
> --
> 1.7.1
> 
> 
> 
> 
> ----- End forwarded message -----
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux