Subject: Re: SMP re-entrancy in kernel drivers/"bottom half?"
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Jonathan Stone <jonathan@dsg.stanford.edu>
List: tech-kern
Date: 12/17/2003 15:29:06
In message <1071703267.022118.2010.nullmailer@yamt.dyndns.org>,
YAMAMOTO Takashi :

>are you suggesting a "global" SPL? (ie. not per cpu)

Of course; thats one thing the spinlocks do.


>i'm confused.
>how bottom-half drivers works simultaneously while all of them
>need to acquire the spinlock corresponding to the lowest SPL?

Let us use "True device IPLs" to mean those IPL levels where runs
interrupt service routines.  I'm suggesting we have one spinlock per
device instance for those interrupt levels; and one (global) spinlock
for higher levels.  Assume, for now, that at most one CPU is running
software-interrupt routines or `top half' kernel code.

If an interrupt-service entrypoint needs to raise its IPL above the
level where the kernel entered it (hwere, for its own device softc,
the spinlock in the softc guarantees atomic access), then it has
to acquire the global spinlock()s for IPLs above device entrypoints.

This assumes that code at IPL_NET never needs to go to IPL_BIO.
As far as I can tell thats a safe assumption.


>why not just acquire kernel_lock when accessing the subsystem without
>fine grained locks?

I suppose that should work, but its awfully heavyhanded.