On 10/09/15(Thu) 08:46, Mike Larkin wrote:
> On Thu, Sep 10, 2015 at 08:17:39AM -0500, Aaron Poffenberger wrote:
> > On 09/10/15 03:59, Stefan Sperling wrote:
> > >On Wed, Sep 09, 2015 at 09:43:44PM -0500, Aaron Poffenberger wrote:
> > >>Occasional problems with loading firmware for urtwn as seen near the end
> > >>of
> > >>this dmesg:
> > >> urtwn0: could not load firmware page 1
> > >>
> > >>I've also seen the same message for page 0.
> > >
> > >Interesting. I don't think I've seen this before. How often does it occur?
> > >Can you please apply the following patch and show us what it prints now?
> > >
> > >Index: if_urtwn.c
> > >===================================================================
> > >RCS file: /cvs/src/sys/dev/usb/if_urtwn.c,v
> > >retrieving revision 1.50
> > >diff -u -p -r1.50 if_urtwn.c
> > >--- if_urtwn.c 24 Aug 2015 04:07:38 -0000 1.50
> > >+++ if_urtwn.c 10 Sep 2015 08:49:45 -0000
> > >@@ -2575,8 +2575,8 @@ urtwn_load_firmware(struct urtwn_softc *
> > > mlen = MIN(len, R92C_FW_PAGE_SIZE);
> > > error = urtwn_fw_loadpage(sc, page, ptr, mlen);
> > > if (error != 0) {
> > >- printf("%s: could not load firmware page %d\n",
> > >- sc->sc_dev.dv_xname, page);
> > >+ printf("%s: could not load firmware page %d "
> > >+ "(error %d)\n", sc->sc_dev.dv_xname, page, error);
> > > goto fail;
> > > }
> > > ptr += mlen;
> > >
> >
> > It usually happens after suspend/resume. Not after every resume but usually
> > after the second or third.
> >
> > The dmesg I sent was the first time I saw it at boot.
> >
> > I'm setting up source on this system. I'll try the patch as soon as all the
> > bits are in place.
> >
>
> Is firmware trying to be loaded during DVACT_RESUME by mistake?
>
> I looked (quickly) but couldn't tell since we usually don't have _activate(..)
> functions for USB (since we detach and reattach on suspend/resume).
>
> Firmware should be loaded during DVACT_WAKEUP, not DVACT_RESUME. When do we
> do the USB bus explore? during _WAKEUP or _RESUME?
USB bus explore is done by a specific thread, the usb task thread
(usbtask). During DVACT_RESUME an explore task is schedule, which
means the usb task thread is ``wakeup(9)''.
Since preemption is re-enabled before DVACT_WAKEUP runs, this
thread might end up running before DVACT_WAKEUP, but I can't say
if it matters or not. Does the diff below help?
I'd be interested to see *which* error the function is returning in
this case, especially if it's timeout related...
Index: usb.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/usb.c,v
retrieving revision 1.108
diff -u -p -r1.108 usb.c
--- usb.c 1 Sep 2015 10:00:26 -0000 1.108
+++ usb.c 10 Sep 2015 16:09:22 -0000
@@ -927,7 +927,7 @@ usb_activate(struct device *self, int ac
if (sc->sc_bus->root_hub != NULL)
usb_detach_roothub(sc);
break;
- case DVACT_RESUME:
+ case DVACT_WAKEUP:
sc->sc_bus->dying = 0;
/*