From owner-freebsd-current@FreeBSD.ORG Mon Jan 23 21:34:03 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org 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 6001A16A4C1 for ; Mon, 23 Jan 2006 21:34:02 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail6.speedfactory.net [66.23.216.219]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8DB5A44538 for ; Mon, 23 Jan 2006 21:17:08 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.5b3) with ESMTP id 6791217 for multiple; Mon, 23 Jan 2006 16:18:16 -0500 Received: from localhost (john@localhost [127.0.0.1]) by server.baldwin.cx (8.13.4/8.13.4) with ESMTP id k0NLH2cd003463; Mon, 23 Jan 2006 16:17:07 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-current@freebsd.org Date: Mon, 23 Jan 2006 16:18:03 -0500 User-Agent: KMail/1.9.1 References: <20060121070706.GA32444@cirb503493.alcatel.com.au> In-Reply-To: <20060121070706.GA32444@cirb503493.alcatel.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200601231618.04949.jhb@freebsd.org> X-Virus-Scanned: ClamAV 0.87.1/1247/Sat Jan 21 05:24:51 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=4.2 tests=ALL_TRUSTED autolearn=failed version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx X-Server: High Performance Mail Server - http://surgemail.com r=1653887525 Cc: Peter Jeremy Subject: Re: Panic due to deleting devices twice X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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, 23 Jan 2006 21:34:04 -0000 On Saturday 21 January 2006 02:07, Peter Jeremy wrote: > When deleting a device (using device_delete_child()), all its child > devices are recursively deleted and then device_detach() is called. > > In the case of iicsmb, this causes a panic because iicsmb_detach() > also calls device_delete_child() on the smbus child it has cached in > its softc. By this time that child has been destroyed. > > Looking at device_detach(), it appears that the solution is to create > a bus_child_detached method to inform the parent that a child is being > destroyed so it can invalidate cached pointers to that child. In > practice, there are only 5 bus_child_detached methods (isa, ed, > pccard, cbb and usb), though there are far more device types attached > as children. > > Looking at the iicsmb code, it appears that iicbb and iicsmb both > cache and explicitly delete child devices and therefore both need > bus_child_detached methods. Is this correct? Is there a simpler > alternative? Can they just call bus_generic_detach() instead and not call device_delete_child()? -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org