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 ...

Robert Watson rwatson at FreeBSD.org
Thu Sep 22 03:14:04 PDT 2005


On Wed, 21 Sep 2005, M. Warner Losh wrote:

> : 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.
>
> pointers can be changed atomically on all our platforms.  The only race 
> is that there's a number of pointers that you need to change and you 
> can't change all of them at the same time.  ifp->if_start will either 
> point to the old driver start routine, or it will point to the new 
> routine.  It won't be 1/2 and 1/2.

Well, you also have to be careful because, as with VOPs in VFS, device 
drivers often invoke ifp->if_whatever() during their normal running. 
Most frequently if_input(), which should be OK if done carefully, but we'd 
need to watch out for others.  For example, do any device drivers call 
their own ioctl routines, start routines, etc, via the ifnet structure, or 
only directly via symbols?  What about device drivers that plug into 
complex frameworks like 802.11?

Robert N M Watson


More information about the cvs-src mailing list