Date: Thu, 22 Sep 2005 16:44:21 -0400 From: Andrew Gallatin <gallatin@cs.duke.edu> To: Robert Watson <rwatson@FreeBSD.org> Cc: src-committers@FreeBSD.org, jhb@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org, ru@FreeBSD.org, "M. Warner Losh" <imp@bsdimp.com> 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: <20050922164421.A10259@grasshopper.cs.duke.edu> In-Reply-To: <20050922111002.N34322@fledge.watson.org>; from rwatson@FreeBSD.org on Thu, Sep 22, 2005 at 11:11:36AM %2B0100 References: <20050920223315.V34322@fledge.watson.org> <20050921154153.GB22964@ip.net.ua> <200509211455.59154.jhb@FreeBSD.org> <20050921.130241.102576086.imp@bsdimp.com> <20050922111002.N34322@fledge.watson.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Robert Watson [rwatson@FreeBSD.org] wrote: > > Would if_dead simply replace the function vector, or would it also drain > threads currently in those functions? We have a pervasive problem with > dead functions that fail to drain (phk has fixed this up for cdev, I > believe, and colin for callouts, but there are many others), and without > that there may be problems. However, if adding draining and refcounting > on entering ifnet methods, we need to be very cautious about the > performance impact. The if_dead() method is basically what MacOSX does. The device operations are replaced by an dlil_recycle_$NAME, which drop packets, return EOPNOTSUPP, etc. I'd hate to see us overhead in the transmit routine to do reference counting to protect against a race which can only happen on detach, which is quite rare. Replacing if_output and sleeping a second or two to wait for threads to drain should solve 99.99% of the races. Nothing in if_output should be blocking, so I don't see the need for real refcounting. For ioctl, just put a lock around all calls into ifp->if_ioctl(), and make sure if_dead grabs that lock before replacing if_ioctl(). Nobody cares about if_ioctl() performance do they? Maybe my viewpoint is too restricted, because I have never had to deal with an mii, or hardware that does really dumb stuff... Drew
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050922164421.A10259>