From owner-freebsd-current@FreeBSD.ORG Tue Oct 7 11:02:12 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AE63116A4B3 for ; Tue, 7 Oct 2003 11:02:12 -0700 (PDT) Received: from zibbi.icomtek.csir.co.za (zibbi.icomtek.csir.co.za [146.64.24.58]) by mx1.FreeBSD.org (Postfix) with ESMTP id EEC9B43FEC for ; Tue, 7 Oct 2003 11:02:09 -0700 (PDT) (envelope-from jhay@zibbi.icomtek.csir.co.za) Received: from zibbi.icomtek.csir.co.za (localhost [IPv6:::1]) h97I23qs037362 for ; Tue, 7 Oct 2003 20:02:03 +0200 (SAST) (envelope-from jhay@zibbi.icomtek.csir.co.za) Received: (from jhay@localhost) by zibbi.icomtek.csir.co.za (8.12.9/8.12.9/Submit) id h97I23v6037361 for current@freebsd.org; Tue, 7 Oct 2003 20:02:03 +0200 (SAST) (envelope-from jhay) Date: Tue, 7 Oct 2003 20:02:02 +0200 From: John Hay To: current@freebsd.org Message-ID: <20031007180202.GA37174@zibbi.icomtek.csir.co.za> References: <20031004190217.GA10149@zibbi.icomtek.csir.co.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031004190217.GA10149@zibbi.icomtek.csir.co.za> User-Agent: Mutt/1.4i Subject: Re: umass panic when connecting camera X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2003 18:02:12 -0000 > > I have decided to upgrade my home box from a March -current to the latest > stuff and now when I connect my HP850 digital camera to the usb port, it > panics the machine. I got a dump and according to the instruction pointer > and kldstat, it must be inside the umass, but I think something confuse > gdb a little because that doesn't show up in the backtrace or maybe it is > just me not knowing how to convince gdb to tell me: > > ########### > --- > Fatal trap 12: page fault while in kernel mode > fault virtual address = 0x10 > fault code = supervisor read, page not present > instruction pointer = 0x8:0xc0729c26 > stack pointer = 0x10:0xc6317cbc > frame pointer = 0x10:0xc6317cd0 > code segment = base 0x0, limit 0xfffff, type 0x1b > = DPL 0, pres 1, def32 1, gran 1 > processor eflags = interrupt enabled, resume, IOPL = 0 > current process = 13 (swi8: tty:sio clock) > trap number = 12 > panic: page fault Ok, it seems that when plugging in a device, the contacts can have some "noise" and you get a disconnect inbetween. If that happens before the timeout() in umass, bad things can happen. I have added an untimeout() and now everything seems ok. Patch at the end. Any comments from people a little more knowledgable in the umass/usb area? John -- John Hay -- John.Hay@icomtek.csir.co.za / jhay@FreeBSD.org Index: umass.c =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/umass.c,v retrieving revision 1.91 diff -u -r1.91 umass.c --- umass.c 20 Sep 2003 08:18:16 -0000 1.91 +++ umass.c 7 Oct 2003 16:35:45 -0000 @@ -396,6 +396,7 @@ usbd_device_handle sc_udev; /* USB device */ struct cam_sim *umass_sim; /* SCSI Interface Module */ + struct callout_handle rescanh; /* timeout handle */ unsigned char flags; /* various device flags */ # define UMASS_FLAGS_GONE 0x01 /* devices is no more */ @@ -2165,7 +2166,7 @@ /* XXX This will bomb if the driver is unloaded between attach * and execution of umass_cam_rescan. */ - timeout(umass_cam_rescan, sc, MS_TO_TICKS(200)); + sc->rescanh = timeout(umass_cam_rescan, sc, MS_TO_TICKS(200)); } return(0); /* always succesfull */ @@ -2179,6 +2180,7 @@ umass_cam_detach_sim(struct umass_softc *sc) { if (sc->umass_sim) { + untimeout(umass_cam_rescan, sc, sc->rescanh); if (xpt_bus_deregister(cam_sim_path(sc->umass_sim))) cam_sim_free(sc->umass_sim, /*free_devq*/TRUE); else