From owner-cvs-src@FreeBSD.ORG Wed Sep 21 19:19:05 2005 Return-Path: X-Original-To: cvs-src@FreeBSD.org 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 C237D16A41F; Wed, 21 Sep 2005 19:19:05 +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 24C1643D46; Wed, 21 Sep 2005 19:19:04 +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 j8LJIpIn049073; Wed, 21 Sep 2005 22:18:51 +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 04469-11; Wed, 21 Sep 2005 22:18:50 +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 j8LJIokc049070 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 21 Sep 2005 22:18:50 +0300 (EEST) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.13.3/8.13.3) id j8LJJ67q027909; Wed, 21 Sep 2005 22:19:07 +0300 (EEST) (envelope-from ru) Date: Wed, 21 Sep 2005 22:19:06 +0300 From: Ruslan Ermilov To: "M. Warner Losh" Message-ID: <20050921191906.GA24516@ip.net.ua> References: <20050920223315.V34322@fledge.watson.org> <20050921154153.GB22964@ip.net.ua> <200509211455.59154.jhb@FreeBSD.org> <20050921.130241.102576086.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3V7upXqbjpZ4EhLz" Content-Disposition: inline In-Reply-To: <20050921.130241.102576086.imp@bsdimp.com> 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, rwatson@FreeBSD.org, cvs-all@FreeBSD.org, jhb@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/an if_an.c src/sys/dev/arl if_arl_isa.c src/sys/dev/awi if_awi_pccard.c src/sys/dev/cm if_cm_isa.c src/sys/dev/cnw if_cnw.c src/sys/dev/cp if_cp.c src/sys/dev/cs if_cs.c src/sys/dev/ed if_ed.c src/sys/dev/em if_em.c ... X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 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, 21 Sep 2005 19:19:06 -0000 --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 21, 2005 at 01:02:41PM -0600, M. Warner Losh wrote: > In message: <200509211455.59154.jhb@FreeBSD.org> > John Baldwin writes: > : > 5. Fix all drivers to set some flag in foo_detach() and foo_shutdown= () > : > and refuse to work in foo_ioctl() if it's set. This should fix > : > panics when BPF listener is attached while interface goes away or > : > module is unloaded. >=20 > : I'd rather 5) be simpler in=20 > : that it only check in the flags case to not force the driver lock to be= =20 > : acquired for all the ioctls that the driver doesn't actually handle. = =20 > : Actually, I think I'd really prefer that we think about how to fix the = BPF=20 > : issue in BPF itself if possible. It may be that we don't need to set t= he=20 > : flags (i.e. skip the actual ioctl) if the interface is in the process o= f=20 > : detaching and we can make that change centrally without having to scatt= er=20 > : gone flags in all the drivers. >=20 > This would solve the race at hand. However, it wouldn't solve the > problems with driver shutdown racing with other things in the system > (like ifconfig during detach). >=20 > I've knocked around the idea of creating a if_dead() function that one > would call before foo_stop(). if_dead would just return (possibly an > error) for all the entry points before the device is actually > detached. This would mean that we don't need to add flags to all the > drivers, but we do need to change all the detach routine. This would > avoid the LOCK operations that you are worried about... >=20 I'm afraid you cannot safely change the ifnet method pointers, if you mean that foo_detach() should set ifp->if_start etc. to point to if_dead(). Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --3V7upXqbjpZ4EhLz Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFDMbIqqRfpzJluFF4RAs3RAJ0dHKisGR2zN6Wq1kLUlpmQxvr5EQCfUUJm mUN1nI9IOdxasbElPAhmDe0= =4MoQ -----END PGP SIGNATURE----- --3V7upXqbjpZ4EhLz--