Greg, Here is the port power control rework for your consideration now that Alan has finished acking it (see summary below). Patch 9 had one outstanding minor question from Alan that I believe I have addressed. Patch 16 has a checkpatch warning "WARNING: msleep < 20ms can sleep for up to 20ms", but it's flagging old code that simply moved and a 20ms timeout is acceptable. Changes since v9 [1]: * Reworked the forced wakeup mechanism in patch 17 to use pm_request_resume() * Random collection of fixlets and rewordings suggested by Alan. ===== This series addresses the following disconnect scenarios when attempting to use port power-off. 1/ Superspeed devices downgrade to their hispeed connection when rx-detection fails on the superspeed pins. Address this by preventing superspeed port poweroff/suspension until the peer port is suspended, and powering on the superspeed port before the hispeed port is resumed. This depends on the ability to identify peer ports (patches 5-8, and patch 10 implements the policy). 2/ khubd prematurely disconnects ports that are in the process of being resumed or reset. After this series khubd will ignore ports in the pm-runtime-suspended or suspending state, or force active ports in the resuming state (patch 14). While it is running it holds a new port status lock to synchronize the port status changes of usb_port_{suspend|resume} and usb_reset_and_verify_device() (patch 15). 3/ Superspeed devices fail to reconnect after a 2 second timeout This event has two causes: 3.1/ Repeated {Set|Clear}PortFeature(PORT_POWER) toggles results in the the device switching to its hispeed connection (due to perceived instability of the superspeed connection). Address this by arranging for the child device to be woken up and complete a resume cycle when the parent port resumes (patch 17). 3.2/ Devices may require a warm reset when recovering the power session. When the child device is woken up per above and the port timed out on reconnect, force a warm-reset during the child's reset-resume (patch 18). [1]: v9: http://marc.info/?l=linux-usb&m=139952735227163&w=2 --- ACK => Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> ack => Acked-by another reviewer ACK [01/19] USB: mutual exclusion for resetting a hub and power-managing a port ACK [02/19] usb: disable port power control if not supported in wHubCharacteristics ACK [03/19] usb: rename usb_port device objects ACK [04/19] usb: cleanup setting udev->removable from port_dev->connect_type ACK [05/19] usb: assign default peer ports for root hubs ACK [06/19] usb: assign usb3 external hub port peers ACK [07/19] usb: find internal hub tier mismatch via acpi ACK [08/19] usb: sysfs link peer ports [09/19] usb: make usb_port flags atomic, rename did_runtime_put to child_usage ACK [10/19] usb: block suspension of superspeed port while hispeed peer is active ACK [11/19] usb: don't clear FEAT_C_ENABLE on usb_port_runtime_resume failure ACK [12/19] usb: usb3 ports do not support FEAT_C_ENABLE ACK [13/19] usb: refactor port handling in hub_events() ACK [14/19] usb: synchronize port poweroff and khubd ACK [15/19] usb: introduce port status lock ACK [16/19] usb: hub_handle_remote_wakeup() depends on CONFIG_PM_RUNTIME=y ACK [17/19] usb: resume child device when port is powered on ack [18/19] usb: force warm reset to break link re-connect livelock [19/19] usb: documentation for usb port power off mechanisms Alan Stern (1): USB: mutual exclusion for resetting a hub and power-managing a port Dan Williams (17): usb: disable port power control if not supported in wHubCharacteristics usb: rename usb_port device objects usb: cleanup setting udev->removable from port_dev->connect_type usb: assign default peer ports for root hubs usb: assign usb3 external hub port peers usb: find internal hub tier mismatch via acpi usb: sysfs link peer ports usb: make usb_port flags atomic, rename did_runtime_put to child_usage usb: block suspension of superspeed port while hispeed peer is active usb: don't clear FEAT_C_ENABLE on usb_port_runtime_resume failure usb: usb3 ports do not support FEAT_C_ENABLE usb: refactor port handling in hub_events() usb: synchronize port poweroff and khubd usb: introduce port status lock usb: hub_handle_remote_wakeup() depends on CONFIG_PM_RUNTIME=y usb: resume child device when port is powered on usb: force warm reset to break link re-connect livelock Lan Tianyu (1): usb: documentation for usb port power off mechanisms Documentation/usb/power-management.txt | 242 ++++++++ drivers/usb/core/hcd.c | 45 + drivers/usb/core/hub.c | 965 +++++++++++++++++--------------- drivers/usb/core/hub.h | 43 + drivers/usb/core/port.c | 310 +++++++++- drivers/usb/core/usb-acpi.c | 107 ++-- drivers/usb/core/usb.h | 16 - 7 files changed, 1166 insertions(+), 562 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