Date: Tue, 25 Nov 2008 10:20:30 -0700 (MST) From: "M. Warner Losh" <imp@bsdimp.com> To: huntting@glarp.com Cc: drivers@FreeBSD.org Subject: Re: mutex quandry Message-ID: <20081125.102030.-1272479009.imp@bsdimp.com> In-Reply-To: <200811251707.mAPH7JRg090619@antediluvian.glarp.com> References: <20081124.134236.723203643.imp@bsdimp.com> <200811251707.mAPH7JRg090619@antediluvian.glarp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <200811251707.mAPH7JRg090619@antediluvian.glarp.com> Brad Huntting <huntting@glarp.com> writes: : : >: The combination of checking sc_running and incrementing sc_inuse : >: needs to be atomic (hence a mutex around them) but at some point : >: detach() has to destroy the mutex but my code may still need to use : >: it. : > : >Your solution to this is to make sure that never happens. Anything : >else is really racy. If you are destroying your mutex and allowing : >detach to return, the entire sc is freed, so you're dead from that : >anyway... : : Fair enough. I guess I was just too focused on my small part of : the larger system. : : But that brings up another issue. How do my (kernel level) users : know if my module is loaded or not? I cant find any section 9 docs : on kernal loadable modules. Am I looking in the wrong place? Or : do I just need to read the source. It should be documented in section 9. Use level users can do a kldstat to find this information. I think kern_kldload will load the module, but I'm not sure how to get status. I've cc'd drivers@ to see if someone there knows. Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081125.102030.-1272479009.imp>