From owner-freebsd-current@FreeBSD.ORG Mon Jul 19 22:38:54 2004 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 43F5D16A4CE; Mon, 19 Jul 2004 22:38:54 +0000 (GMT) Received: from harmony.village.org (rover.village.org [168.103.84.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id DF0F443D53; Mon, 19 Jul 2004 22:38:53 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.11/8.12.11) with ESMTP id i6JMat92034848; Mon, 19 Jul 2004 16:36:55 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Mon, 19 Jul 2004 16:36:58 -0600 (MDT) Message-Id: <20040719.163658.97851603.imp@bsdimp.com> To: pjd@freebsd.org From: "M. Warner Losh" In-Reply-To: <20040719175241.GJ57678@darkness.comp.waw.pl> References: <20040719173819.GI57678@darkness.comp.waw.pl> <40FC0832.3040805@freebsd.org> <20040719175241.GJ57678@darkness.comp.waw.pl> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: freebsd-current@freebsd.org cc: scottl@freebsd.org Subject: Re: Unloading USB driver while device is attached. 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: Mon, 19 Jul 2004 22:38:54 -0000 In message: <20040719175241.GJ57678@darkness.comp.waw.pl> Pawel Jakub Dawidek writes: : On Mon, Jul 19, 2004 at 11:43:14AM -0600, Scott Long wrote: : +> >Yeah, but even on 'kldunload -f' it should be possible to clean up : +> >and avoid panic on next load. : +> > : +> : +> What usually happens in that a timeout happens and the driver handler no : +> longer exists (i.e. forgot to call untimeout), or an interrupt happens : +> and the driver forgot to deregister the interrupt. There are also a lot : +> of rase possibilities in here even if the driver attempts to do the : +> right thing. There really isn't a 'one size fits all' way to deal with : +> this kind of thing. The driver author needs to build quiesce and : +> shutdown semantics into the driver design. : : If your device is inserted and you load a driver everything is ok, : because no driver is attached to this device. : So, as I see it, device should be totally detached before unload and : I susspect that something is missing in USB layer, not in all drivers. : That's why when I load a driver again, USB thinks it is somehow connected : to existing device, but it isn't. Actually, usb won't reattach on kldload. That's definitely missing from the usb layer. This has been noted many times in the past. However, its missing shouldn't cause the panic. That's likely a different bug. Warner