Subject: Re: newlock
To: Garrett D'Amore <firstname.lastname@example.org>
From: Andrew Doran <ad@NetBSD.org>
Date: 09/04/2006 03:03:18
On Sun, Sep 03, 2006 at 05:28:22PM -0700, Garrett D'Amore wrote:
> What's wrong with the standard solaris way of doing this?
> find b...
> /* possibly unlock a now *
> mutex_exit(a); /* unless you did it earlier */
> It gives full flexibility, and keeps everything explicit.
If releasing spin mutexes out of order, then we restore the saved SPL too
early and there's a short window where an interrupt can fire and we deadlock
on the mutex:
mutex_enter(a) <- original interrupt mask saved
mutex_exit(a) <- original interrupt mask restored
mutex_exit(b) <- deadlock
The question is: how to allow that cleanly? I don't know how Solaris handles
that with spin mutexes. From what I know, I doubt it does..