Subject: Re: newlock
To: None <>
From: Andrew Doran <>
List: tech-kern
Date: 09/03/2006 14:34:30

On Sat, Sep 02, 2006 at 08:51:02PM +0100, David Laight wrote:

> On Sat, Sep 02, 2006 at 04:22:15PM +0100, Andrew Doran wrote:
> >
> > The *_high() variants are a special case for the guts of the kernel where
> > we need to release spin locks out of order. They aren't pretty, and I'm
> > not sure if they should be documented for device drivers.
> I'm not sure really solve the problem either.

enter_high() is a micro-optimisation and I think we can do away with it.

> Since netbsd uses splraise() - so we don't have any problem about acquiring
> a lock enabling some interrupts - there is no real need for the lock variants.
> The unlock versions really need to transfer the original spl level to the
> second lock - or swap over the saved spl levels between two locks.
> Otherwise it becomes very easy to get the spl level wrong.

The assumptions were that we would be dealing with two or more locks, with the
same SPL, and that the acquire and release would be done locally. That's not
general enough though. So, following your suggestion, something like this:

	.. find b ..
        mutex_link(b, mutex_exit_linked(a));
        .. update b ..

This is a part of the design I'm not comfortable with, and I think the above
is quite ugly. What do people think?