Date: Fri, 8 Dec 2000 03:11:08 +0000 (GMT) From: Terry Lambert <tlambert@primenet.com> To: brian@Awfulhak.org (Brian Somers) Cc: julian@elischer.org (Julian Elischer), brian@Awfulhak.org (Brian Somers), smp@FreeBSD.ORG, archie@FreeBSD.ORG Subject: Re: Netgraph and SMP Message-ID: <200012080311.UAA02374@usr08.primenet.com> In-Reply-To: <200012070201.eB721Yt44116@hak.lan.Awfulhak.org> from "Brian Somers" at Dec 07, 2000 02:01:33 AM
next in thread | previous in thread | raw e-mail | index | archive | help
> > > Inside it's own lock (preventing any other dependent modules from > > > appearing), it asks the module if it's ok to unload. > > > > > > This is obviously more tricky than it sounds. We've got to ensure > > > that if any character device entry points have been created > > > (make_dev() etc), we block the relevant entry points so that we can > > > ENODEV if the MOD_UNLOAD works. > > > > but what if the process has already entered the driver? > > Then it should hold a lock that fails in the kldload syscall when it > does a mutex_trylock() on it. Again, this is somewhere that a read/ > write mutex would be handy. kldunload ends up trying for the write > lock while driver entry points try for the read lock. In Solaris, the entry into the driver would hold a reference, which would result in the reference count being incremented. Only modules with a 0 reference count can be unloaded. This same mechanism is used for vnodes, and for modules on which other modules depend. It works well, ans is very light weight. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200012080311.UAA02374>