Toggling port power currently leads to three unintended disconnect scenarios that are addressed by this rework of port power recovery and usb device resume: 1/ Superspeed devices downgrade to their hispeed connection: fix this by preventing superspeed poweroff until the peer port is suspended. This depends on the ability to identify peer ports (patches 1-4), and then patch 5 implements the policy. 2/ khubd prematurely disconnects ports that are in the process of being resumed or reset. khubd now ignores ports in the pm-runtime-suspended state (patch 9) and holds a lock to synchronize the port status changes of usb_port_{suspend|resume} (patch 11). 3/ Superspeed devices fail to reconnect: Seen during repeated toggles of the port power state. Fixed by forcing a full recovery cycle of the usb_device before allowing the next suspend / khubd run (patch 12). Also, for devices that live lock on reconnect the port runtime resume path now has the capability to force a reset-resume to be a warm-reset-resume (patch 13). New since v3 [1]: * Addressed Sarah's comment about the FEAT_C_ENABLE patch, split it into patch 6 and 7 [2] * Addressed Alan's comments [3] about usb_port_{suspend|resume} synchronization. Refactored hub_events() (patch 8) and introduced usb_port.status_lock (patch 11) accordingly * Clarified the documentation to indicate the perils of unbinding usbcore interface drivers (lose ability to resume) and added more details about the ordering policies enforced by the fix for bug 1 above. * Added patch 10 to fix a long standing xhci bug made more prominent by the ordering of events forced by the port status lock. * Clarified a few changelogs and added commentary to the code [1] v3: http://marc.info/?l=linux-usb&m=138912657113817&w=2 [2] status lock discussion: http://marc.info/?t=138912664200010&r=1&w=2 [3] split FEAT_C_ENABLE patch: http://marc.info/?l=linux-usb&m=138989014115864&w=2 [4] don't unbind usbcore: http://marc.info/?l=linux-usb&m=138982558731254&w=2 --- [PATCH v4 01/14] usb: assign default peer ports for root hubs [PATCH v4 02/14] usb: assign usb3 external hub port peers [PATCH v4 03/14] usb: find internal hub tier mismatch via acpi [PATCH v4 04/14] usb: sysfs link peer ports [PATCH v4 05/14] usb: defer suspension of superspeed port while peer is powered [PATCH v4 06/14] usb: don't clear FEAT_C_ENABLE on usb_port_runtime_resume failure [PATCH v4 07/14] usb: usb3 ports do not support FEAT_C_ENABLE [PATCH v4 08/14] usb: refactor port handling in hub_events() [PATCH v4 09/14] usb: synchronize port poweroff and khubd [PATCH v4 10/14] xhci: cancel in-flight resume requests when the port is powered off [PATCH v4 11/14] usb: introduce port status lock [PATCH v4 12/14] usb: guarantee child device resume on port poweron [PATCH v4 13/14] usb: force warm reset to break resume livelock [PATCH v4 14/14] usb: documentation for usb port power off mechanisms Documentation/usb/power-management.txt | 236 ++++++++++++++++++++ drivers/usb/core/hub.c | 372 +++++++++++++++++++------------- drivers/usb/core/hub.h | 18 ++ drivers/usb/core/port.c | 277 ++++++++++++++++++++++-- drivers/usb/core/usb-acpi.c | 35 ++- drivers/usb/core/usb.h | 2 drivers/usb/host/xhci-hub.c | 12 + 7 files changed, 770 insertions(+), 182 deletions(-) -- 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