On 10/05/14(Sat) 12:02, Abel Abraham Camarillo Ojeda wrote:
> On Fri, May 9, 2014 at 3:12 PM, Abel Abraham Camarillo Ojeda
> <acam...@verlet.org> wrote:
> > On Fri, May 9, 2014 at 8:47 AM, Martin Pieuchot <mpieuc...@nolizard.org> 
> > wrote:
> >> On 09/05/14(Fri) 08:36, Abel Abraham Camarillo Ojeda wrote:
> >>> On Fri, May 9, 2014 at 4:37 AM, Abel Abraham Camarillo Ojeda
> >>> <acam...@verlet.org> wrote:
> >>>
> >>> This commit breaks resume for my machine:
> >>
> >> Could you find which device and/or controller breaks it?  Since you have
> >> only one mouse attached to your machine, can you resume if the mouse is
> >> unplugged?
> >
> > USB mouse presence/not-presence shows no changes.
> >
> >> If not, can you resume with ohci(4) disable (you won't be
> >> able to use your USB mouse)?
> >
> > disabling ohci enables resume again.
> >
> 
> Any ideas to debug this further?

The problem comes from the fact that during resume, interrupts are
enabled before uhub(4) had a chance to be attached to any *hci(4)
and something wrong happens during this window with the root hub
status change interrupt.

A similar situation can be reproduced by disabling uhub(4) at boot.

I don't know what's happening in your case, because AFAIK having an
*hci(4) driver without root hub should be just fine and I can't
reproduce your problem with the hardware I have at hand.

But on the other hand, we could avoid such situation and attach the
root hub before interrupts get enabled.  Could you try the diff below 
and let me know if it fixes the regression for you?

Index: usb.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/usb.c,v
retrieving revision 1.95
diff -u -p -r1.95 usb.c
--- usb.c       31 Mar 2014 16:18:06 -0000      1.95
+++ usb.c       10 May 2014 18:48:54 -0000
@@ -900,10 +900,19 @@ usb_activate(struct device *self, int ac
                if (sc->sc_bus->root_hub != NULL)
                        usb_detach_roothub(sc);
                break;
-       case DVACT_WAKEUP:
+       case DVACT_RESUME:
                sc->sc_bus->dying = 0;
+
+               /*
+                * Make sure the root hub is present before interrupts
+                * get enabled.   As long as the bus is in polling mode
+                * it is safe to call usbd_new_device() now since root
+                * hub transfers do not need to sleep.
+                */
+               sc->sc_bus->use_polling++;
                if (!usb_attach_roothub(sc))
                        usb_needs_explore(sc->sc_bus->root_hub, 0);
+               sc->sc_bus->use_polling--;
                break;
        case DVACT_DEACTIVATE:
                rv = config_activate_children(self, act);

Reply via email to