diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-04-07 22:04:12 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-04-07 22:04:12 +0000 |
commit | 4057679b76ae5e1f7e79802be8399396f29c0b09 (patch) | |
tree | ee0e7deeda4465230f19b4cd323a13029abff68f /libdde_linux26/include/linux | |
parent | a70f3193e50f8fe4524bf2ff4666c4265521218d (diff) |
Revert to upstream DDE cli_sti code, with __thread
Flags in Linux and L4 are a per-processor thing. In userland, that simply maps
to a per-thread thing. Using a lock instead introduces deadlocks.
Diffstat (limited to 'libdde_linux26/include/linux')
-rw-r--r-- | libdde_linux26/include/linux/spinlock.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libdde_linux26/include/linux/spinlock.h b/libdde_linux26/include/linux/spinlock.h index 6830752b..ab862f99 100644 --- a/libdde_linux26/include/linux/spinlock.h +++ b/libdde_linux26/include/linux/spinlock.h @@ -372,10 +372,6 @@ extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); #else /* DDE_LINUX */ -unsigned long fake_local_irq_disable_flags(void); -void fake_local_irq_enable(void); -void fake_local_irq_restore(unsigned long flags); - #define spin_lock_init(l) \ do { \ ddekit_lock_init(&(l)->ddekit_lock); \ @@ -398,7 +394,7 @@ void fake_local_irq_restore(unsigned long flags); #define read_lock(lock) spin_lock(lock) #define write_lock(lock) spin_lock(lock) -#define spin_lock_irq(lock) fake_local_irq_disable_flags(); spin_lock(lock) +#define spin_lock_irq(lock) local_irq_disable(); spin_lock(lock) #define spin_lock_bh(lock) spin_lock(lock) #define read_lock_irq(lock) spin_lock_irq(lock) #define read_lock_bh(lock) spin_lock_bh(lock) @@ -415,7 +411,7 @@ void fake_local_irq_restore(unsigned long flags); #define read_unlock(lock) spin_unlock(lock) #define write_unlock(lock) spin_unlock(lock) -#define spin_unlock_irq(lock) spin_unlock(lock); fake_local_irq_enable() +#define spin_unlock_irq(lock) spin_unlock(lock); local_irq_enable() #define spin_unlock_bh(lock) spin_unlock(lock) #define read_unlock_irq(lock) spin_unlock_irq(lock) #define read_unlock_bh(lock) spin_unlock_bh(lock) @@ -424,7 +420,7 @@ void fake_local_irq_restore(unsigned long flags); #define spin_lock_irqsave(lock, flags) \ do { \ - flags = fake_local_irq_disable_flags(); \ + local_irq_save(flags); \ spin_lock(lock);\ } while (0); @@ -434,7 +430,7 @@ void fake_local_irq_restore(unsigned long flags); #define spin_unlock_irqrestore(lock, flags) \ do { \ spin_unlock(lock); \ - fake_local_irq_restore (flags); \ + local_irq_restore(flags); \ } while (0); #define read_unlock_irqrestore(lock, flags) spin_unlock_irqrestore(lock, flags) @@ -450,7 +446,12 @@ static int __lockfunc spin_trylock(spinlock_t *lock) #define _raw_spin_unlock(l) spin_unlock(l) #define _raw_spin_trylock(l) spin_trylock(l) -#define spin_trylock_irqsave(lock, flags) spin_trylock(lock) +#define spin_trylock_irqsave(lock, flags) \ +({ \ + local_irq_save(flags); \ + spin_trylock(lock) ? \ + 1 : ({ local_irq_restore(flags); 0; }); \ +}) #define read_trylock(l) spin_trylock(l) #define write_trylock(l) read_trylock(l) |