aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/include
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2009-06-12 04:26:22 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2009-06-12 04:27:29 -0400
commitce58ae6f7f6bdd48c87472ff830a6d586ff076b2 (patch)
tree20d9139566563a3fa8ca012e6444a0e6262bb9e2 /arch/s390/include
parent76d4e00a05d06c1d1552adea24fcf6182c9d8999 (diff)
[S390] implement interrupt-enabling rwlocks
arch backend for f5f7eac41db827a47b2163330eecd7bb55ae9f12 "Allow rwlocks to re-enable interrupts". Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/include')
-rw-r--r--arch/s390/include/asm/spinlock.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/arch/s390/include/asm/spinlock.h b/arch/s390/include/asm/spinlock.h
index f3861b09ebb0..c9af0d19c7ab 100644
--- a/arch/s390/include/asm/spinlock.h
+++ b/arch/s390/include/asm/spinlock.h
@@ -122,8 +122,10 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lp)
122#define __raw_write_can_lock(x) ((x)->lock == 0) 122#define __raw_write_can_lock(x) ((x)->lock == 0)
123 123
124extern void _raw_read_lock_wait(raw_rwlock_t *lp); 124extern void _raw_read_lock_wait(raw_rwlock_t *lp);
125extern void _raw_read_lock_wait_flags(raw_rwlock_t *lp, unsigned long flags);
125extern int _raw_read_trylock_retry(raw_rwlock_t *lp); 126extern int _raw_read_trylock_retry(raw_rwlock_t *lp);
126extern void _raw_write_lock_wait(raw_rwlock_t *lp); 127extern void _raw_write_lock_wait(raw_rwlock_t *lp);
128extern void _raw_write_lock_wait_flags(raw_rwlock_t *lp, unsigned long flags);
127extern int _raw_write_trylock_retry(raw_rwlock_t *lp); 129extern int _raw_write_trylock_retry(raw_rwlock_t *lp);
128 130
129static inline void __raw_read_lock(raw_rwlock_t *rw) 131static inline void __raw_read_lock(raw_rwlock_t *rw)
@@ -134,6 +136,14 @@ static inline void __raw_read_lock(raw_rwlock_t *rw)
134 _raw_read_lock_wait(rw); 136 _raw_read_lock_wait(rw);
135} 137}
136 138
139static inline void __raw_read_lock_flags(raw_rwlock_t *rw, unsigned long flags)
140{
141 unsigned int old;
142 old = rw->lock & 0x7fffffffU;
143 if (_raw_compare_and_swap(&rw->lock, old, old + 1) != old)
144 _raw_read_lock_wait_flags(rw, flags);
145}
146
137static inline void __raw_read_unlock(raw_rwlock_t *rw) 147static inline void __raw_read_unlock(raw_rwlock_t *rw)
138{ 148{
139 unsigned int old, cmp; 149 unsigned int old, cmp;
@@ -151,6 +161,12 @@ static inline void __raw_write_lock(raw_rwlock_t *rw)
151 _raw_write_lock_wait(rw); 161 _raw_write_lock_wait(rw);
152} 162}
153 163
164static inline void __raw_write_lock_flags(raw_rwlock_t *rw, unsigned long flags)
165{
166 if (unlikely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) != 0))
167 _raw_write_lock_wait_flags(rw, flags);
168}
169
154static inline void __raw_write_unlock(raw_rwlock_t *rw) 170static inline void __raw_write_unlock(raw_rwlock_t *rw)
155{ 171{
156 _raw_compare_and_swap(&rw->lock, 0x80000000, 0); 172 _raw_compare_and_swap(&rw->lock, 0x80000000, 0);
@@ -172,9 +188,6 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
172 return _raw_write_trylock_retry(rw); 188 return _raw_write_trylock_retry(rw);
173} 189}
174 190
175#define __raw_read_lock_flags(lock, flags) __raw_read_lock(lock)
176#define __raw_write_lock_flags(lock, flags) __raw_write_lock(lock)
177
178#define _raw_read_relax(lock) cpu_relax() 191#define _raw_read_relax(lock) cpu_relax()
179#define _raw_write_relax(lock) cpu_relax() 192#define _raw_write_relax(lock) cpu_relax()
180 193