From owner-cvs-all@FreeBSD.ORG Fri Sep 16 09:19:18 2005 Return-Path: X-Original-To: cvs-all@freebsd.org Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9597916A41F; Fri, 16 Sep 2005 09:19:18 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id B1B4143D45; Fri, 16 Sep 2005 09:19:17 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from localhost (rocky.ip.net.ua [82.193.96.2]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id j8G9JFAW038093; Fri, 16 Sep 2005 12:19:15 +0300 (EEST) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua ([82.193.96.10]) by localhost (rocky.ipnet [82.193.96.2]) (amavisd-new, port 10024) with LMTP id 69652-16; Fri, 16 Sep 2005 12:19:14 +0300 (EEST) Received: from heffalump.ip.net.ua (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id j8G9JE10038090 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 16 Sep 2005 12:19:14 +0300 (EEST) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.13.3/8.13.3) id j8G9JS0p023554; Fri, 16 Sep 2005 12:19:28 +0300 (EEST) (envelope-from ru) Date: Fri, 16 Sep 2005 12:19:28 +0300 From: Ruslan Ermilov To: John Baldwin Message-ID: <20050916091928.GG88456@ip.net.ua> References: <200509151859.j8FIxY6v007639@repoman.freebsd.org> <200509151521.14204.jhb@FreeBSD.org> <20050915205639.GD88456@ip.net.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="S5HS5MvDw4DmbRmb" Content-Disposition: inline In-Reply-To: <20050915205639.GD88456@ip.net.ua> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at ip.net.ua Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/dev/re if_re.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2005 09:19:18 -0000 --S5HS5MvDw4DmbRmb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 15, 2005 at 11:56:39PM +0300, Ruslan Ermilov wrote: > The first is the BPF detach bad interaction with foo_detach(), > as described in re_detach(). This panic is real with (I think) > all drivers. And testing IFF_DRV_RUNNING here doesn't seem to > be able to prevent the panic. Perhaps the fix would be to > move ether_ifdetach() before foo_stop() in foo_detach(), I'm > not yet sure. >=20 I tried with rl(4) PCCARD, by moving ether_ifdetach() before rl_stop() in rl_detach(). It fixes the panic when you eject the card, but doesn't fix it when kldunloading the module. The difference is that rl_detach() is called already after miibus0 and rlphy0 has been detached when kldunloading the module. When ejecting the card, rl_detach() is called first. What happens when you kldunload the module with BPF listener attached, is that bpfdetach() calls rl_ioctl() to reset promisc, that calls rl_init_locked(), and that results in mii =3D device_get_softc(sc->rl_miibus); being NULL (remember the miibus has already been detached), and that panics later here: mii_mediachg(mii); When we reset IFF_UP, rl_ioctl(SIOCSIFFLAGS) silently exits and no harm is done. So the question is: how do we prevent this from happening without resetting IFF_UP. One possible solution would be to add sc->detaching, similar to sc->suspended, abd check it in rl_ioctl(). Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --S5HS5MvDw4DmbRmb Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFDKo4gqRfpzJluFF4RAgwpAJ9XUqVw6jUfvNIhgXxyPBEiybgaJACeNHE1 5zkD9pY0litznIDunXgrCMo= =2nIV -----END PGP SIGNATURE----- --S5HS5MvDw4DmbRmb--