LWN.net Logo

A realtime preemption overview

A realtime preemption overview

Posted Oct 5, 2009 15:18 UTC (Mon) by ecapoccia (guest, #60755)
Parent article: A realtime preemption overview

#1 Preemptible critical sections

"This preemptibility means that you can block while acquiring a spinlock, which in turn means
that it is illegal to acquire a spinlock with either preemption or interrupts disabled (the one
exception to this rule being the _trylock variants, at least as long as you don't repeatedly invoke
them in a tight loop). This also means that spin_lock_irqsave() does -not- disable hardware
interrupts when used on a spinlock_t."

a) "..while acquiring" One thing it is not clear to me is that with the new spinlocks a process can
block only before having obtained the lock (namely while spinning), or also when holding the
lock itself, inside the critical section. Apparently from the rest of the article (and the title of the
subsection) the second interpratation is correct, "while acquiring" is also "while holding". Is this
correct?

b) "it is illegal to acquire a spinlock with either preemption or interrupts disabled", I can figure
out that if one process blocks while holding a spinlock, should the preemption be disabled then
the local processor will hang since it wouldn't be able to run any other kernel path. Is this
correct? However I can't figure out why it is mandatory to have the interrupts enabled. Can you
clarify?


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds