Re: Spinlocks: the saga

Andi Kleen (ak@muc.de)
30 Jun 1999 21:52:15 +0200


lists@cyclades.com (Linux Lists) writes:

> Hello,
>
> I'm thinking about the issues of the use of spinlocks in the Cyclades
> async driver. However, I have a very minimal idea on how spinlocks work.
> Before you ask: yes, I've read the Documentation/spinlocks.txt and the
> include/asm/spinlock.h files.
>
> The biggest issue is that we're talking about multiport serial cards,
> which means several devices under one card, one IRQ, and sometimes one
> chip (the CD1400 controls 4 ports simultaneously). Thus, the access
> control should be done in three levels:
>
> - one spinlock for regions that are accessed inside the interrupt handler;
> - one for regions that are specific to each port;
> - one for regions that are specific to each chip;
>
> Plus, these regions overlap, so how to decide which spinlock to use at
> that specific case?? Plus, how to synchronize the spinlock calls?? Plus,
> how to control the spinlock (if needed) from inside interrupt handlers??
>
> Well, I have tons of questions. As I know you're all busy, I'd like (if
> possible) some pointers about spinlocks (if possible, about spinlocks _in
> Linux_ ...). Books, URL's, src code, etc. ... anything is welcome. If you
> are willing to help with the code as well, you're welcome too ... ;)

Curt Schimmel: Unix Systems for modern architectures.

It is expensive, but it has really a great discussion about spinlocks
and SMP issues so it is worth the money (and actually it partways just
looks like a tutorial on how to SMPize the Linux kernel, although the word
Linux is never mentioned ;)

With the number of locks I wouldn't try to hard to fine grain it, often
less is more (if you have too many locks you add much inter CPU cacheline
traffic). If you have only one IRQ probably a single subsystem lock is
enough because it serializes anwyays (?), but actually only real world
profiling can tell you for sure.

-Andi

-- 
This is like TV. I don't like TV.

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