From owner-freebsd-arch@FreeBSD.ORG Wed Jul 21 16:38:50 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BA67616A4CE for ; Wed, 21 Jul 2004 16:38:50 +0000 (GMT) Received: from pfepc.post.tele.dk (pfepc.post.tele.dk [195.41.46.237]) by mx1.FreeBSD.org (Postfix) with ESMTP id 85DB343D45 for ; Wed, 21 Jul 2004 16:38:50 +0000 (GMT) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (0x50a07c53.naenxx7.adsl-dhcp.tele.dk [80.160.124.83]) by pfepc.post.tele.dk (Postfix) with ESMTP id D01E7262831; Wed, 21 Jul 2004 18:38:48 +0200 (CEST) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.11/8.12.11) with ESMTP id i6LGcldd084656; Wed, 21 Jul 2004 18:38:47 +0200 (CEST) (envelope-from phk@critter.freebsd.dk) To: "M. Warner Losh" From: "Poul-Henning Kamp" In-Reply-To: Your message of "Wed, 21 Jul 2004 08:49:26 MDT." <20040721.084926.84362543.imp@bsdimp.com> Date: Wed, 21 Jul 2004 18:38:47 +0200 Message-ID: <84655.1090427927@critter.freebsd.dk> Sender: phk@critter.freebsd.dk cc: arch@freebsd.org Subject: Re: kldunload DIAGNOSTIC idea... X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jul 2004 16:38:50 -0000 In message <20040721.084926.84362543.imp@bsdimp.com>, "M. Warner Losh" writes: >[[ only cc'd arch@ ]] > >In message: <83182.1090412961@critter.freebsd.dk> > "Poul-Henning Kamp" writes: >: >Any ideas on how network interfaces should >: >work in this? >: >: I talked with Robert briefly about this yesterday, and the problem >: there is that struct ifnet is embedded in the softc. If the softc >: had a pointer to the ifnet, then we could do something similar, but >: as long as it's embedded we're stuck. > >Why is that the case? We don't detach the ifnet stuff after deleting >the softc. Why would a pointer to ifnet in the softc make this >easier? Because it would allow the softc could be freed before the ifnet structure. >I mean, I understand that having a pointer would insulate the size of >ifnet from the driver, but there's so many offsets in ifnet that are >encoded in the driver that doesn't seem that big a win. That's not the point here. The problem here is that we cannot unload the driver until we have hunted down and exterminated all references to the ifnet structure. If softc only pointed to the ifnet, we could neuter the ifnet (like we do for cdev and vnodes with a set of dead_* functions) wait for all threads to drain out of the module and unload it. The ifnet cleanup will happen "when convenient". It is less of an issue in networks than in cdevsw{} context, but dismantling things from above is easier than the opposite. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.