Subject: Re: SMP re-entrancy in kernel drivers/"bottom half?"
To: YAMAMOTO Takashi <>
From: Jonathan Stone <>
List: tech-kern
Date: 12/17/2003 14:58:57
In message <>,
YAMAMOTO Takashi writes:

>why need to acquire all spinlocks between them?
>i can't imagine how it deadlocks.

Elementary: we have to maintain the invariant ``at most one CPU at or
above any given [hardware] prioritly level' or we lose the
synchronization semantics of SPLs (higher SPls than the hypothetical
SMP-safe interrupt-routine driver entrypoints).

Suppose a NIC interrupt fires, a CPU takes an interrupt and goes into
a network driver at IPL_NET. Suppose a disk driver fires, goes into
the kernel at IPL_BIO. Now suppose both of those drivers wants to go
to splvm() or splhigh(), or ..., to access some data-structure
synchronized at that level.

Thats the appeal of this idea. A truly fine-grained-SMP kernel would
have separate locks for each such data structure, or at least per
kernel subsystem.  By making hardware-priority SPLs acquire a
spinlock, we can try allowing multiple bottom-half drivers into the
kernel simultaneously, yet defer implementing the spinlocks for all
those other data structures to some later date.