-
Committer:
Martin Decky
-
Date:
2010-05-20 19:30:18 UTC
-
Revision ID:
martin@uranus.dsrg.hide.ms.mff.cuni.cz-20100520193018-ja307eekwu5hstjg
Add interrupts-disabled spinlocks whose purpose is the semantic distinction between spinlocks acquired always with interrupts disabled and normal spinlocks.
The compile-time distinction is implemented by the means of the type system and basic code correctness properties can be checked by the debugging assertions during run-time (with CONFIG_DEBUG)
- Correct bracketing of top-level interrupts-disabled spinlocks
- Correctness of the use of nested interrupts-disabled spinlocks (interrupts must be actually disabled)
- Basic consistency of places where the interrupt level is restored
The API encapsulates the physical manipulation with the interrupt levels and also two common locking patterns
- Sequential unlocking of spinlock A before locking of spinlock B without restoring original interrupt level (irq_spinlock_pass())
- Hand-over-hand locking of two locks in the correct locking order, e.g. if A precedes B, then locking of B before unlocking A (irq_spinlock_exchange())
A new HAL function interrupts_disabled() should be implemented in each port to support the run-time checks of correctly disabled interrupts while locking nested interrupts-disabled spinlocks
(only in debug builds, not used in non-debug builds).