Subject: Re: newlock
To: Andrew Doran <>
From: Chuck Silvers <>
List: tech-kern
Date: 09/24/2006 09:51:11
On Fri, Sep 08, 2006 at 06:46:17PM +0100, Andrew Doran wrote:
> 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;
> 	}

instead of requiring a special unlock interface to handle this,
why not just store the original IPL in the cpu_info structure?
(since the interrupt-blocking stuff is only for spin-only mutexes, right?)
we would also need a counter for the number of interrupt-blocking mutexes
held, so that we can know when to put back the original interrupt mask.
this would make the API simpler for driver writers to use without
much overhead.