Date: Sat, 23 Feb 2002 13:20:05 -0800 From: Alfred Perlstein <bright@mu.org> To: Matthew Dillon <dillon@apollo.backplane.com> Cc: John Baldwin <jhb@FreeBSD.org>, Seigo Tanimura <tanimura@FreeBSD.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/coda coda_venus.c src/sys/compat/linprocfs Message-ID: <20020223212005.GK80761@elvis.mu.org> In-Reply-To: <200202232056.g1NKuKf41350@apollo.backplane.com> References: <200202232030.g1NKU4m87533@freefall.freebsd.org> <20020223204610.GG80761@elvis.mu.org> <200202232056.g1NKuKf41350@apollo.backplane.com>
next in thread | previous in thread | raw e-mail | index | archive | help
* Matthew Dillon <dillon@apollo.backplane.com> [020223 12:56] wrote: > > :Matt, any chance you can co-ordinate with jhb (or not) to add > :functionality to witness such that it can detect when a mutex > :is aquired while holding a pool mutex? > : > :-Alfred > > This would be very easy to do. Since witness already uses curthread > we simply have a field in curthread indicating that we are holding a > pool mutex. If witness_lock() sees this set then it complains. The > pool mutexes could be init'd with another MTX flag indicating that > they are leaf mutexes (i.e. MTX_LEAF). > > It is so easy it might be useful to do this test for INVARIANTS in > general without requiring WITNESS to be turned on. > > What do you think John? I've also asked john to implement a sleephold()/sleepdrop() functionaity. the premise is this: As you've noticed there's a bunch of code in sys/kern and sys/vm that has comments to the effect of: "this shouldn't block, but i'm not sure" Well, since for the most part blocking occurs rarely, what you do is keep a nested count in the proc struct that records weather or not you can sleep. Basically you have a td->td_sleephold that starts at zero, sleephold() will td->td_sleephold++, and sleepdrop() will td->td_sleephold-- as well as check for < 0. Then for invariants you add to all functions that may block something like mightsleep(); at the entrance to the function. Anyone calling into this function with a td->td_sleephold > 0 will trigger an assertion and panic. As far as further assertions, I've brought this up with John and he's ok with it, I just haven't had the time to implement it. I think he'd be ok with deltas but he's heard enough of my ideas for invariants, I guess i just need to get my hands dirty with it. :) -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' Tax deductible donations for FreeBSD: http://www.freebsdfoundation.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020223212005.GK80761>