From owner-freebsd-bugs@FreeBSD.ORG Thu Sep 16 11:55:25 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8425116A4D0; Thu, 16 Sep 2004 11:55:25 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3CCBD43D49; Thu, 16 Sep 2004 11:55:25 +0000 (GMT) (envelope-from roam@FreeBSD.org) Received: from freefall.freebsd.org (roam@localhost [127.0.0.1]) i8GBtPDI002057; Thu, 16 Sep 2004 11:55:25 GMT (envelope-from roam@freefall.freebsd.org) Received: (from roam@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i8GBtOWb002053; Thu, 16 Sep 2004 11:55:24 GMT (envelope-from roam) Date: Thu, 16 Sep 2004 11:55:24 GMT From: Peter Pentchev Message-Id: <200409161155.i8GBtOWb002053@freefall.freebsd.org> To: o1b6@tiscali.it, roam@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: kern/71791: Fatal trap 12: page fault while in kernel mode X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2004 11:55:25 -0000 Synopsis: Fatal trap 12: page fault while in kernel mode State-Changed-From-To: open->feedback State-Changed-By: roam State-Changed-When: Thu Sep 16 11:48:24 GMT 2004 State-Changed-Why: This looks awfully similar to the USB panics that I discussed with Warner Losh last week; he committed the fixes to -CURRENT 6 days ago, but merged them into 5.x about two days after 5.3-BETA4 was tagged. Can you apply the following patches to your kernel source, then recompile/reinstall the kernel, reboot and try again? The patches are actually taken directly from the 5.x source tree - src/sys/dev/usb/uhub.c revision 1.62.2.1 and src/sys/dev/usb/usb_subr.c revision 1.69.2.1. If you do not feel comfortable applying patches, you could simply fetch those two files from http://cvsweb.FreeBSD.org/src/sys/dev/usb/ and place them in your src/sys/dev/usb/ directory. Index: src/sys/dev/usb/uhub.c =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/uhub.c,v retrieving revision 1.62 retrieving revision 1.62.2.1 diff -u -r1.62 -r1.62.2.1 --- src/sys/dev/usb/uhub.c 15 Aug 2004 23:39:18 -0000 1.62 +++ src/sys/dev/usb/uhub.c 13 Sep 2004 03:00:06 -0000 1.62.2.1 @@ -38,7 +38,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/usb/uhub.c,v 1.62 2004/08/15 23:39:18 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/usb/uhub.c,v 1.62.2.1 2004/09/13 03:00:06 imp Exp $"); /* * USB spec: http://www.usb.org/developers/docs/usbspec.zip @@ -90,7 +90,6 @@ Static void uhub_intr(usbd_xfer_handle, usbd_private_handle,usbd_status); #if defined(__FreeBSD__) -Static bus_child_detached_t uhub_child_detached; Static bus_child_location_str_t uhub_child_location_str; Static bus_child_pnpinfo_str_t uhub_child_pnpinfo_str; #endif @@ -110,7 +109,6 @@ uhub_match, uhub_attach, uhub_detach, uhub_activate); #elif defined(__FreeBSD__) USB_DECLARE_DRIVER_INIT(uhub, - DEVMETHOD(bus_child_detached, uhub_child_detached), DEVMETHOD(bus_child_pnpinfo_str, uhub_child_pnpinfo_str), DEVMETHOD(bus_child_location_str, uhub_child_location_str), DEVMETHOD(bus_driver_added, bus_generic_driver_added), @@ -123,7 +121,6 @@ devclass_t uhubroot_devclass; Static device_method_t uhubroot_methods[] = { - DEVMETHOD(bus_child_detached, uhub_child_detached), DEVMETHOD(bus_child_location_str, uhub_child_location_str), DEVMETHOD(bus_child_pnpinfo_str, uhub_child_pnpinfo_str), DEVMETHOD(bus_driver_added, bus_generic_driver_added), @@ -378,7 +375,7 @@ DPRINTFN(3,("uhub_explore: %s port %d status 0x%04x 0x%04x\n", USBDEVNAME(sc->sc_dev), port, status, change)); if (change & UPS_C_PORT_ENABLED) { - DPRINTF(("uhub_explore: C_PORT_ENABLED\n")); + DPRINTF(("uhub_explore: C_PORT_ENABLED 0x%x\n", change)); usbd_clear_port_feature(dev, port, UHF_C_PORT_ENABLE); if (change & UPS_C_CONNECT_STATUS) { /* Ignore the port error if the device @@ -398,7 +395,7 @@ else printf("%s: port error, giving up " "port %d\n", - USBDEVNAME(sc->sc_dev), port); + USBDEVNAME(sc->sc_dev), port); } } if (!(change & UPS_C_CONNECT_STATUS)) { @@ -684,35 +681,6 @@ } return (0); } - -/* Called when a device has been detached from it */ -Static void -uhub_child_detached(device_t self, device_t child) -{ - struct uhub_softc *sc = device_get_softc(self); - usbd_device_handle devhub = sc->sc_hub; - usbd_device_handle dev; - int nports; - int port; - int i; - - if (!devhub->hub) - /* should never happen; children are only created after init */ - panic("hub not fully initialised, but child deleted?"); - - nports = devhub->hub->hubdesc.bNbrPorts; - for (port = 0; port < nports; port++) { - dev = devhub->hub->ports[port].device; - if (dev == NULL || dev->subdevs == NULL) - continue; - for (i = 0; dev->subdevs[i]; i++) { - if (dev->subdevs[i] == child) { - dev->subdevs[i] = NULL; - return; - } - } - } -} #endif Index: src/sys/dev/usb/usb_subr.c =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/usb_subr.c,v retrieving revision 1.69 retrieving revision 1.69.2.1 diff -u -r1.69 -r1.69.2.1 --- src/sys/dev/usb/usb_subr.c 15 Aug 2004 23:39:18 -0000 1.69 +++ src/sys/dev/usb/usb_subr.c 13 Sep 2004 03:01:56 -0000 1.69.2.1 @@ -10,7 +10,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.69 2004/08/15 23:39:18 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.69.2.1 2004/09/13 03:01:56 imp Exp $"); /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -905,6 +905,10 @@ if (dv) { return (USBD_NORMAL_COMPLETION); } + /* + * Free subdevs so we can reallocate it larger for the number of + * interfaces + */ tmpdv = dev->subdevs; dev->subdevs = NULL; free(tmpdv, M_USB); @@ -1016,9 +1020,6 @@ if (dv != NULL) { return (USBD_NORMAL_COMPLETION); } - tmpdv = dev->subdevs; - dev->subdevs = 0; - free(tmpdv, M_USB); /* * The generic attach failed, but leave the device as it is. @@ -1346,11 +1347,13 @@ di->udi_speed = dev->speed; if (dev->subdevs != NULL) { - for (i = 0; dev->subdevs[i] && - i < USB_MAX_DEVNAMES; i++) { - strncpy(di->udi_devnames[i], USBDEVPTRNAME(dev->subdevs[i]), - USB_MAX_DEVNAMELEN); - di->udi_devnames[i][USB_MAX_DEVNAMELEN-1] = '\0'; + for (i = 0; dev->subdevs[i] && i < USB_MAX_DEVNAMES; i++) { + if (device_is_attached(dev->subdevs[i])) + strlcpy(di->udi_devnames[i], + USBDEVPTRNAME(dev->subdevs[i]), + USB_MAX_DEVNAMELEN); + else + di->udi_devnames[i][0] = 0; } } else { i = 0; http://www.freebsd.org/cgi/query-pr.cgi?pr=71791