Subject: MP Alpha kernels go multi-user
To: Ross Harvey <ross@ghs.com>
From: Jason R Thorpe <thorpej@zembu.com>
List: source-changes
Date: 04/20/2001 10:38:22
[ Moved to port-alpha@netbsd.org  --thorpej ]

On Fri, Apr 20, 2001 at 10:14:11AM -0700, Ross Harvey wrote:

 > > This makes Alpha MP kernels boot multiuser.  In fact, this commit
 > > is being made from my dual-CPU AlphaServer 1200 running an MP kernel.
 > 
 > This really rocks!  Another great job by Jason Thorpe and Bill Sommerfeld!

You should have seen how excellently the system wedged when I attemped
a parallel kernel build :-)

One more bug to fix -- I was engaged in a little too much wishful
thinking, I suppose -- I put pmap_emulate_reference() outside the
kernel_lock perimeter, since the pmap module has fine-grained locking.

However, if an interrupt comes in while you're holding the pvhead->map
lock in pmap_emulate_reference(), you will acquire the kernel_lock...

Now consider a system call of page fault on the other CPU that causes
pmap_enter() to be called, which tries to acquire the map->pvhead lock
direction (note it's already holding kernel_lock).

Now you're screwed -- one cpu did "kernel_lock -> pmap_lock" and the
other did "pmap_lock -> kernel_lock".  Deadlock.

Sigh, guess I have to put pmap_emulate_reference() in the kernel_lock
perimeter for now (until kernel_lock is no longer required by interrupt
handlers...)

But, still, pretty cool :-)

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>