Date: Wed, 21 Sep 2005 22:34:10 +0300 From: Ruslan Ermilov <ru@freebsd.org> To: "M. Warner Losh" <imp@bsdimp.com> 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 ... Message-ID: <20050921193410.GC24516@ip.net.ua> In-Reply-To: <20050921.132322.116350250.imp@bsdimp.com> References: <200509211455.59154.jhb@FreeBSD.org> <20050921.130241.102576086.imp@bsdimp.com> <20050921191906.GA24516@ip.net.ua> <20050921.132322.116350250.imp@bsdimp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--E13BgyNx05feLLmH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 21, 2005 at 01:23:22PM -0600, M. Warner Losh wrote: > In message: <20050921191906.GA24516@ip.net.ua> > Ruslan Ermilov <ru@FreeBSD.org> writes: > : On Wed, Sep 21, 2005 at 01:02:41PM -0600, M. Warner Losh wrote: > : > In message: <200509211455.59154.jhb@FreeBSD.org> > : > John Baldwin <jhb@FreeBSD.org> writes: > : > : > 5. Fix all drivers to set some flag in foo_detach() and foo_shut= down() > : > : > and refuse to work in foo_ioctl() if it's set. This should f= ix > : > : > panics when BPF listener is attached while interface goes awa= y 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 t= o be=20 > : > : acquired for all the ioctls that the driver doesn't actually handle= =2E =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 s= et the=20 > : > : flags (i.e. skip the actual ioctl) if the interface is in the proce= ss of=20 > : > : detaching and we can make that change centrally without having to s= catter=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(). >=20 > Why not? What's the problem? >=20 The time you change say ifp->if_start in foo_detach(), stack may call it and get a half-changed pointer. Unless we invent locking shared between stack and the drivers. Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --E13BgyNx05feLLmH Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFDMbWyqRfpzJluFF4RAlTxAJsHWS0yXLMwj7xT/kguznmrHu2RYACeIf6L UrnAWhDDQ+iuEk6KOXScVXY= =rcbv -----END PGP SIGNATURE----- --E13BgyNx05feLLmH--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050921193410.GC24516>