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 18:42:44
>then, before you acquire the lock in softc,
>you have to acquire all of lower spl's "global" locks, haven't you?

No. Hardware interrupts can already interrupt lower-priority
software-interrupt callout or `upper half' cod at spl0()/IPL_NONE; no
real change there.  Those lower-priority threads already do an
splnet() or splbio() before touching datastructures accessed by the
IP_NET or IPL_BIO driver code.  

The only way this could fail is if upper-half code tries to call into
a driver entrypoint whilst already at IP_{BIO,NET}. Then the downward-
calling code (which has teh IPL_NET spinlock) could deadlock against
an interrupt in the driver (which already has the softc spinlock)
trying to acquire the `global' IPL_NET lock.

For network devices, that can only happen for the output path, and I'm
pretty sure that the networking code calls downward into drivers at no
more than softint priority.

(I admit I haven thought through the BIO case as carefully, but then
I'm a networking guy.)