On 11/06/2014 08:16 PM, Alan Stern wrote: >> --- now get back out of suspend --- >> - usb_resume() is invoked with different RPM status. >> - hub_activate() is invoked. The status URB is enqueued again, RPM >> remains unchanged. >> - aaaaand we are done > > Ah. In usb_resume(), what happened after usb_resume_both() returned? > The code says this: > > status = usb_resume_both(udev, msg); > if (status == 0) { > pm_runtime_disable(dev); > pm_runtime_set_active(dev); > pm_runtime_enable(dev); > unbind_marked_interfaces(udev); > } > > So if usb_resume_both() returns 0, the runtime PM status is supposed to > get changed to RPM_ACTIVE by the pm_runtime_set_active() call. so it returns 0 but pm_runtime_set_active() return with -EBUSY: __pm_runtime_set_status() { … if (parent) { if (… && parent->power.runtime_status != RPM_ACTIVE) { error = -EBUSY; … if (error) goto out; … The parent is musb-hdrc.1.auto. The sort order of resume is: musb-dsps 47401c00.usb: bus resume => dsps_resume() (glue layer) musb-hdrc musb-hdrc.1.auto: bus resume => musb_resume(2328) and after musb_resume() completes I see usb_resume() being invoked (and the first hub resume). Later, once khubd kicks in, I see musb_runtime_resume() probably via usb_autopm_get_interface(hub). That means the musb-hcd is not RPM_ACTIVE after resume and this is what USB expects. If I put pm_runtime_get_sync() + put in musb_resume() then the problem is gone. I don't see ehci-hcd doing this in resume, in fact I don't see ehci doing pm_runtime_* at all. So for ehci the device is probably always RPM_ACTIVE. And musb does it only in probe and nowhere else. I would expect it in the ISR as well but it is what it is. On the the other hand: musb_resume() invokes usb_hcd_resume_root_hub() what probably brings usb_resume() for the hub into the game. Shouldn't it pm_get_sync() the HCD? And still, if the HCD has a short suspend delay it might go into suspend before the khubd is invoked (but then it probably kills the status URB). > Alan Stern Sebastian -- 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