B0;264;0cOn Wed, Nov 24, 2010 at 09:07:46PM +0000, Jacob Meuser wrote: > On Tue, Nov 23, 2010 at 10:28:17AM +0100, MERIGHI Marcus wrote: > > Jacob Meuser <[email protected]>, 2010-11-22 23:06:23: > > > > > uvm_fault(0xd0a1a040, 0x0, 0, 1) -> e > > > > kernel: page fault trap, code=0 > > > > Stopped at usbd_do_request_flags_pipe+0x18: movl > > > > 0x258(%eax),%ec > > > > x > > > > ddb> > > > > ddb> trace > > > > usbd_do_request_flags_pipe(d1f3ac00,2,dc16aef8,0,0) at > > > > usbd_do_request_flags_pi > > > > pe+0x18 > > > > usbd_do_request_flags(d1f3ac00,dc16aef8,0,0,0) at > > > > usbd_do_request_flags+0x3c > > > > usbd_do_request(d1f3ac00,dc16aef8,0,d079ab1d,d0a0f200) at > > > > usbd_do_request+0x37 > > > > usbd_reset_port(d1f3ac00,1,d1f3a980,d03e1d87,40) at usbd_reset_port+0x42 > > > > uhub_explore(d1f3ac00,d1f3accc,dc16af8c,d07978b6,d1f3ac80) at > > > > uhub_explore+0x16 > > > > f > > > > usb_explore(d1f3ac80,20,d097e6b6,0,d6d7f768) at usb_explore+0x3f > > > > usb_task_thread(d6d7f768) at usb_task_thread+0x76 > > > > > > does the device work? does the kernel see devices attached to the USB? > > > > yes. below dmesg with pcmcia card attached as well as usb stick via > > pcmcia card. watch out for "pcmcia card inserted" and "usb stick > > inserted". > > ok then it's not the initial uhub_explore() just hanging out > forever ... apparently the device generates a hub interrupt > when it's removed. > > I've just sent a patch to tech@ which I think will fix > the crash. the subject is 'more usb detach love'. can you > see if that makes a difference?
on second thought, can you try the following first? our handling of hub interrupts is, well, sloppy. we totally ignore the status bit field, which tells us which port had a status change, or whether the hub had a status change. uhub_explore() only deals with port status changes, so we only need to run it when there is a port status change. uhub_explore() should also use the status bit field to know what ports need to be checked, instead of checking every port, but I'll leave that for later. I'm also interested if you see the following kernel messages when running with this diff: uhub_intr: no change uhub_intr: hub changed but not ports -- [email protected] SDF Public Access UNIX System - http://sdf.lonestar.org Index: uhub.c =================================================================== RCS file: /cvs/src/sys/dev/usb/uhub.c,v retrieving revision 1.55 diff -u -p uhub.c --- uhub.c 23 Sep 2010 05:44:15 -0000 1.55 +++ uhub.c 25 Nov 2010 02:48:52 -0000 @@ -596,12 +596,30 @@ void uhub_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status) { struct uhub_softc *sc = addr; + u_int8_t i, bval, chg = 0; DPRINTFN(5,("uhub_intr: sc=%p\n", sc)); if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->sc_ipipe); - else if (status == USBD_NORMAL_COMPLETION) - usb_needs_explore(sc->sc_hub, 0); - else + else if (status == USBD_NORMAL_COMPLETION) { + for (i = 0; i < sc->sc_statuslen; i++) { + bval = sc->sc_statusbuf[i]; + if (i == 0 && (bval & 0x1)) { + /* hub status change */ + chg |= 0x1; + } + if ((i == 0 && bval > 1) || (i > 0 && bval > 0)) { + /* port status change */ + chg |= 0x2; + break; + } + } + if (chg == 0) + printf("%s: no change\n", __func__); + else if (chg & 0x2) + usb_needs_explore(sc->sc_hub, 0); + else if (chg & 0x1) + printf("%s: hub changed but not ports\n", __func__); + } else DPRINTFN(8, ("uhub_intr: unknown status, %d\n", status)); }
