Subject: Re: Pulling simple syscalls out from the giant lock
To: Ignatios Souvatzis <is@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 06/09/2005 08:05:09
On Wed, Jun 08, 2005 at 01:09:30PM +0200, Ignatios Souvatzis wrote:
> 
> Unmapped is a real problem; without this, you could still 
> 	pp = p->parent;
> 	do {
> 		qq = pp;
> 		ppid = pp->pid;
> 		pp = p->parent;
> 	} while (pp != qq);

Technically, it could change twice, and the memory could be used for
something else in between.....

We were told that almost any attempt to avoid a lock is likely to be buggy.
This is particularly true on sparc systems due to the cpu 'store buffer'.

On the original topic:

I suspect we'll have to use either the Unixware or Solaris semantics.

Unixware:  lock = lock_alloc(); oldpl = getlock(lock, newpl);
Solaris:   lock = lock_alloc(newpl); getlock(lock);

Exposing the pl to the locking primitives allows the useful sequence:
	pl = getlock(table_lock, newpl);
	item = lookup(table,...);
	unlock(table_lock, getlock(item->lock, newpl));
	....
	unlock(item->lock, pl);

(the table_lock migth be a read_write lock, and the item->lock a simple lock)

The above is difficult to do on solaris.

The actual solaris interface makes it very hard to create code that can be
called by ISRs - since you need the IRQ not the IPL when creating the lock.

	David

-- 
David Laight: david@l8s.co.uk