Subject: Re: newlock
To: Andrew Doran <>
From: Bill Studenmund <>
List: tech-kern
Date: 09/11/2006 11:07:36
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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);

Note, we have a potential issue here as well. In addition to the necessity
of a locking order, if both locks are driver locks (have IPL cookies),=20
then we have to make sure we grab them in the right order.

Since IPLs change from arch to arch, I think it's best to establish one=20
locking hierarchy, then have a routine that can cope with needing to=20
release a to get b. And code will have to cope with the lock potentially=20
being dropped while getting b.

> 	mutex_exit_linked(a, b);
> 	mutex_exit(b);
> 	void
> 	mutex_exit_linked(kmutex_t from, kmutex_t to)
> 	{
> 		to->mtx_oldspl =3D from->mtx_oldspl;
> 	}

That's probably fine.

Take care,


Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.4.3 (NetBSD)