Re: mutexes, locks and so on...

On Wed, Nov 17, 2010 at 12:30:59PM +0100, Johnny Billquist wrote:
>
> There are obviously a lot of calls to mutex_enter and mutex_exit with
> spin mutexes...
Indeed there are. I don't underestand what Matt said about this. When
I was converting /dev/crypto to mutexes I am pretty sure it was explained
to me that the _spin forms of the calls were simply optimizations for when
the programmer knew the mutex to be a spin mutex due to the IPL at which
it was declared. That is, I had a a pile of driver code full of mutex_enter
and mutex_exit which were on a high-IPL mutex and I simply converted it all
to mutex_spin_enter and mutex_spin_exit with qsubst.
Perhaps the rule is that if you take the mutex with spin_enter you must
release it with spin_exit. That would make some sense. But I'd love some
clarity on this point.
> Also a fair number of calls to mutex_spin_exit with the spin lock not
> appearing to be held (I actually set and clear a bit to indicate if the
> mutex is held, in addition to bumping the IPL).
This *does* seem like a bug.
--
Thor Lancelot Simon
tls%rek.tjls.com@localhost
"We cannot usually in social life pursue a single value or a single moral
aim, untroubled by the need to compromise with others." - H.L.A. Hart