From owner-cvs-src@FreeBSD.ORG Wed Sep 22 18:17:43 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4DC6816A4CE; Wed, 22 Sep 2004 18:17:43 +0000 (GMT) Received: from www.cryptography.com (li-22.members.linode.com [64.5.53.22]) by mx1.FreeBSD.org (Postfix) with ESMTP id D4BC843D41; Wed, 22 Sep 2004 18:17:42 +0000 (GMT) (envelope-from nate@root.org) Received: from [10.0.0.34] (adsl-67-127-84-57.dsl.snfc21.pacbell.net [67.127.84.57]) by www.cryptography.com (8.12.8/8.12.8) with ESMTP id i8MIHZDl004153; Wed, 22 Sep 2004 11:17:35 -0700 Message-ID: <4151C1A7.2040905@root.org> Date: Wed, 22 Sep 2004 11:17:11 -0700 From: Nate Lawson User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "M. Warner Losh" References: <20040922060214.7754A16A548@hub.freebsd.org> <20040921230445.B44288@root.org> <20040922.085115.34541167.imp@bsdimp.com> In-Reply-To: <20040922.085115.34541167.imp@bsdimp.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: cvs-src@freebsd.org cc: src-committers@freebsd.org cc: cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/dev/usb usb_port.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2004 18:17:43 -0000 M. Warner Losh wrote: > In message: <20040921230445.B44288@root.org> > Nate Lawson writes: > : On Wed, 22 Sep 2004, Warner Losh wrote: > : > imp 2004-09-22 06:02:10 UTC > : > > : > FreeBSD src repository > : > > : > Modified files: > : > sys/dev/usb usb_port.h > : > Log: > : > Add a temporary workaround to the panic on boot with hub attached and > : > panic on hub detach bugs that have been reported. This work around > : > detaches the device before deleting it. This changes the detach order > : > from in-order to pre-order. This avoids uhub's deleting the children > : > after its subdevs has been deleted. > : > > : > Revision Changes Path > : > 1.68 +1 -0 src/sys/dev/usb/usb_port.h > : > > : > > : > Index: src/sys/dev/usb/usb_port.h > : > diff -u src/sys/dev/usb/usb_port.h:1.67 src/sys/dev/usb/usb_port.h:1.68 > : > --- src/sys/dev/usb/usb_port.h:1.67 Sun Aug 15 23:39:18 2004 > : > +++ src/sys/dev/usb/usb_port.h Wed Sep 22 06:02:10 2004 > : > @@ -422,6 +422,7 @@ > : > #define config_detach(dev, flag) \ > : > do { \ > : > free(device_get_ivars(dev), M_USB); \ > : > + device_detach(dev); \ > : > device_delete_child(device_get_parent(dev), dev); \ > : > } while (0); > : > : Shouldn't you free the ivars after detaching the device? > > I don't think this is the right place to do that. Now I'm the one who is confused. I'm talking about the call to free() right before device_detach(). See above. I meant I think the device_detach() should go before the free(). > : If the device > : releases resources in its attach routine, you may be walking the resource > : list stored in the ivars but that will already have been freed with the > : above code. > > resources aren't stored in ivars. usb devices do not use resources. I see, it's contained in the *HCI driver. But strangely, it sets its own ivars. > : It would also make sense to do this as the exact reverse of > : device creation. > > I don't understand this. Devices need to be detached before being deleted. If they have ivars, it makes sense to kill those after detach, not before. -- Nate