Subject: Re: spl ... MP ...
To: Chapman Flack <nblists@anastigmatix.net>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: tech-kern
Date: 01/07/2006 14:32:36
Chapman Flack <nblists@anastigmatix.net> writes:

> My question is: is this approach sufficient on MP? Do I have
> any guarantees about which processor runs the write handler,
> or fields the device interrupt or callout? Does splraise
> affect any other processor? (My glance at the code looked like
> no.)

In the current kernel-big-lock world, this is sufficent; the big lock
prevents any cross-CPU issues, and the spl() call protects the top
half from the bottom half. 

In a hypothetical future where multiple CPUs may be in the kernel
and/or in interrupt code, it's not; you then need to protect from 
the bottom half (interrupts) on your CPU, and from both halves on all
other CPUs. The most conventional way to do this looks like:

Top half:
splfoo()
simplelock();
...
simpleunlock();
splx();

Bottom half:
[already at splfoo]
simplelock();
...
simpleunlock();


        - Nathan