Subject: Re: newlock
To: Jason Thorpe <thorpej@shagadelic.org>
From: Andrew Doran <ad@netbsd.org>
List: tech-kern
Date: 09/08/2006 18:46:17
On Fri, Sep 08, 2006 at 09:49:34AM -0700, Jason Thorpe wrote:

> Can you explain to me again how the link/exit_linked stuff will work?   
> I want to make sure I have my head wrapped around it properly. :-)

It would look something like this:

	mutex_enter(a);
	mutex_enter(b);
	mutex_exit_linked(a, b);
	mutex_exit(b);

	void
	mutex_exit_linked(kmutex_t from, kmutex_t to)
	{
		to->mtx_oldspl = from->mtx_oldspl;
		MUTEX_SPIN_RELEASE(from);
	}

> I think it could be argued that MUTEX_DRIVER should mean:
> 
> - MUTEX_SPIN if ipl != IPL_NONE
> - MUTEX_DEFAULT if ipl == IPL_NONE
> 
> (Consider a driver that uses no interrupts or callouts at all...)

Agreed.
 
Thanks, 
Andrew