On 30/08/14(Sat) 12:28, ludovic coues wrote:
> 2014-08-30 11:58 GMT+02:00 Martin Pieuchot <mpieuc...@nolizard.org>:
> > On 30/08/14(Sat) 11:46, ludovic coues wrote:
> >> 2014-08-30 10:53 GMT+02:00 Martin Pieuchot <mpieuc...@nolizard.org>:
> >> > Hello Ludovic,
> >> >
> >> > On 28/08/14(Thu) 20:52, ludovic coues wrote:
> >> >> Hello,
> >> >>
> >> >> Recently, I get a kernel page fault every time I try to use the
> >> >> micronucleus [1] command line tool. It 's for uploading an hex file to
> >> >> ATtiny processor, much like arduino's avrude. The crash is pretty
> >> >> consistent, occuring every time I run `micronucleus --run`.
> >> >> I've managed to use it with success in the past on this machine with
> >> >> 55-release so it might be hardware related. I added a realtek wireless
> >> >> device since last time I've get a successful run with micronucleus.
> >> >>
> >> >> I get the following message when I run it:
> >> >> uvm_fault(0xffffffff81daaf001, 0x2, 2, 0, 1) -> e
> >> >> kernel: page fault trap, code=0
> >> >> Stopped at usbd_get_cdesc+035: movzwl 0x2 (%rax),%eax
> >> >>
> >> >> It's followed by the debugger prompt. I don't know how what to do from
> >> >> that point. I'm willing to spend time tracking the source of the
> >> >> problem but I have no idea of what I'm looking for.
> >> >
> >> > Thanks for reporting the problem.  I believe this is the same issue that
> >> > has been reported by Thomas Pfaff in February [0] and fixed post 5.5 [1].
> >> >
> >> > Could you try a snapshot and tell me if you can still reproduce it?
> >> >
> >> > Cheers,
> >> > Martin
> >> >
> >> > [0] http://marc.info/?l=openbsd-bugs&m=139135208628637&w=2
> >> > [1] http://marc.info/?l=openbsd-cvs&m=139194643911061&w=2
> >>
> >> I might have failed to upgrade to snapshot but I still have the error.
> >> Right now, I got the snapshot install56.fs file, used it to run an
> >> upgrade and run sysmerge. I must have done something right as
> >> start_daemon isn't available anymore in /etc/rc.local but the error is
> >> still present.
> >
> > In this case could you send me your dmesg, the output of "usbdevs -dv"
> > and the trace when the trap occurs?
> 

Thanks Ludovic,

> usbdevs -dv:
> [...]
>   port 4 addr 3: high speed, power 100 mA, unconfigured,
> RTL8187B(0x8189), Realtek(0x0bda), rev 2.00, iSerialNumber
> 00e04c000001
>     urtw0

The problem comes from this driver that does not set any configuration
when it attaches itself to the device.

Could you test the diff below, it is a sync with urtwn(4), and tell me
if you can reproduce this problem with it?

Index: if_urtw.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/if_urtw.c,v
retrieving revision 1.47
diff -u -p -r1.47 if_urtw.c
--- if_urtw.c   13 Jul 2014 15:52:49 -0000      1.47
+++ if_urtw.c   1 Sep 2014 08:43:50 -0000
@@ -608,6 +608,19 @@ urtw_attach(struct device *parent, struc
        sc->sc_udev = uaa->device;
        sc->sc_hwrev = urtw_lookup(uaa->vendor, uaa->product)->rev;
 
+       if (usbd_set_config_no(sc->sc_udev, 1, 0) != 0) {
+               printf("%s: could not set configuration no\n",
+                   sc->sc_dev.dv_xname);
+               return;
+       }
+
+       /* Get the first interface handle. */
+       if (usbd_device2interface_handle(sc->sc_udev, 0, &sc->sc_iface) != 0) {
+               printf("%s: could not get interface handle\n",
+                   sc->sc_dev.dv_xname);
+               return;
+       }
+
        printf("%s: ", sc->sc_dev.dv_xname);
 
        if (sc->sc_hwrev & URTW_HWREV_8187) {
@@ -2297,20 +2310,6 @@ urtw_init(struct ifnet *ifp)
        sc->sc_txtimer = 0;
 
        if (!(sc->sc_flags & URTW_INIT_ONCE)) {
-               error = usbd_set_config_no(sc->sc_udev, URTW_CONFIG_NO, 0);
-               if (error != 0) {
-                       printf("%s: could not set configuration no\n",
-                           sc->sc_dev.dv_xname);
-                       goto fail;
-               }
-               /* get the first interface handle */
-               error = usbd_device2interface_handle(sc->sc_udev,
-                   URTW_IFACE_INDEX, &sc->sc_iface);
-               if (error != 0) {
-                       printf("%s: could not get interface handle\n",
-                           sc->sc_dev.dv_xname);
-                       goto fail;
-               }
                error = urtw_open_pipes(sc);
                if (error != 0)
                        goto fail;
@@ -3730,20 +3729,6 @@ urtw_8187b_init(struct ifnet *ifp)
        sc->sc_txtimer = 0;
 
        if (!(sc->sc_flags & URTW_INIT_ONCE)) {
-               error = usbd_set_config_no(sc->sc_udev, URTW_CONFIG_NO, 0);
-               if (error != 0) {
-                       printf("%s: could not set configuration no\n",
-                           sc->sc_dev.dv_xname);
-                       goto fail;
-               }
-               /* Get the first interface handle. */
-               error = usbd_device2interface_handle(sc->sc_udev,
-                   URTW_IFACE_INDEX, &sc->sc_iface);
-               if (error != 0) {
-                       printf("%s: could not get interface handle\n",
-                           sc->sc_dev.dv_xname);
-                       goto fail;
-               }
                error = urtw_open_pipes(sc);
                if (error != 0)
                        goto fail;
Index: if_urtwreg.h
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/if_urtwreg.h,v
retrieving revision 1.15
diff -u -p -r1.15 if_urtwreg.h
--- if_urtwreg.h        26 Nov 2013 20:33:18 -0000      1.15
+++ if_urtwreg.h        1 Sep 2014 08:43:50 -0000
@@ -17,9 +17,6 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define        URTW_CONFIG_NO                  1
-#define        URTW_IFACE_INDEX                0
-
 /*
  * Known hardware revisions.
  */

Reply via email to