lfn
serial
ticket/834-toolchain-update
topic/msim-upgrade
topic/simplify-dev-export
Last change
on this file since e7c42ac0 was 2b4a9f26, checked in by Martin Decky <martin@…>, 15 years ago |
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).
|
-
Property mode
set to
100644
|
File size:
2.1 KB
|
Line | |
---|
1 |
|
---|
2 | SPINNING LOCKS
|
---|
3 | spinlock_lock, spinlock_trylock, spinlock_unlock
|
---|
4 | +------------+
|
---|
5 | | spinlock_t |
|
---|
6 | +------------+
|
---|
7 | |
|
---|
8 | +------------------------------+
|
---|
9 | |
|
---|
10 | INTERRUPTS-DISABLED SPINNING LOCKS |
|
---|
11 | irq_spinlock_lock, irq_spinlock_trylock, irq_spinlock_unlock |
|
---|
12 | +----------------+ |
|
---|
13 | | irq_spinlock_t |<--------------------+
|
---|
14 | +----------------+
|
---|
15 |
|
---|
16 |
|
---|
17 |
|
---|
18 | WAIT QUEUES
|
---|
19 | waitq_sleep_timeout, waitq_wakeup
|
---|
20 | +---------+
|
---|
21 | | waitq_t |
|
---|
22 | +---------+
|
---|
23 | / \
|
---|
24 | SEMAPHORES / \ CONDITION VARIABLES
|
---|
25 | semaphore_down_timeout, semaphore_up condvar_wait_timeout, condvar_signal
|
---|
26 | +--------------+ / \ +-----------+
|
---|
27 | | semaphore_t |<-+ +->| condvar_t |
|
---|
28 | +--------------+ +-----------+
|
---|
29 | | ^
|
---|
30 | | |
|
---|
31 | | +------+
|
---|
32 | V /
|
---|
33 | MUTEXES / READERS/WRITERS LOCKS
|
---|
34 | mutex_lock_timeout, mutex_unlock rwlock_reader/writer_lock_timeout, rwlock_unlock
|
---|
35 | +---------+ / +----------+
|
---|
36 | | mutex_t |------------------------------->| rwlock_t |
|
---|
37 | +---------+ / +----------+
|
---|
38 | | /
|
---|
39 | +------------------------+
|
---|
Note:
See
TracBrowser
for help on using the repository browser.