Re: SMP in 2.4

Matti Aarnio (matti.aarnio@zmailer.org)
Wed, 18 Apr 2001 21:05:46 +0300


On Wed, Apr 18, 2001 at 11:08:22AM -0400, Dennis wrote:
> Does 2.4 have something similar to spl levels or does it still require the
> ridiculous MS-DOSish spin-locks to protect every bit of code?

Lets see -- (besides of MSDOS not having any sort of spinlocks), the
spl() is something out of VAX series of machines, and it really works
by presuming that there is some sort of priority leveling among irq
sources.

At i386 there is only one level of interrupt control, either you
accept interrupts, or you don't. It just doesn't scale very well.

At FreeBSD site there is no documentation of how to handle interrupts,
presumably that is "read the source, luke".

Ah, found some man-page with its description..

Essentially the supported function for spl() is:

spin_lock_irqsave(&sp->lock, flags);

along with its counterpart ( splx() ):

spin_unlock_irqrestore(&sp->lock, flags);

These block interrupts at the LOCAL processor only (no interprocessor
communication hazzle for it), and the spinlocks are for blocking
interrupt processing by *other* processors at SMP systems.
( Linux does distribute interrupts these days to *all* processors
when APIC is in use, and while it is fast and easy to block IRQ
at local processor, getting other processors also to block IRQs
is major slow thing... )

At UP systems the SAME functions are used, but their internal
implementations are slightly different -- no SMP related spinlock
is operated.

For a model, see drivers/net/eepro100.c

> DB
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/