diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2009-06-12 04:26:22 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-06-12 04:27:29 -0400 |
commit | ce58ae6f7f6bdd48c87472ff830a6d586ff076b2 (patch) | |
tree | 20d9139566563a3fa8ca012e6444a0e6262bb9e2 /arch/s390/lib | |
parent | 76d4e00a05d06c1d1552adea24fcf6182c9d8999 (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/lib')
-rw-r--r-- | arch/s390/lib/spinlock.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c index e41f4008afc5..f7e0d30250b7 100644 --- a/arch/s390/lib/spinlock.c +++ b/arch/s390/lib/spinlock.c | |||
@@ -124,6 +124,27 @@ void _raw_read_lock_wait(raw_rwlock_t *rw) | |||
124 | } | 124 | } |
125 | EXPORT_SYMBOL(_raw_read_lock_wait); | 125 | EXPORT_SYMBOL(_raw_read_lock_wait); |
126 | 126 | ||
127 | void _raw_read_lock_wait_flags(raw_rwlock_t *rw, unsigned long flags) | ||
128 | { | ||
129 | unsigned int old; | ||
130 | int count = spin_retry; | ||
131 | |||
132 | local_irq_restore(flags); | ||
133 | while (1) { | ||
134 | if (count-- <= 0) { | ||
135 | _raw_yield(); | ||
136 | count = spin_retry; | ||
137 | } | ||
138 | if (!__raw_read_can_lock(rw)) | ||
139 | continue; | ||
140 | old = rw->lock & 0x7fffffffU; | ||
141 | local_irq_disable(); | ||
142 | if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old) | ||
143 | return; | ||
144 | } | ||
145 | } | ||
146 | EXPORT_SYMBOL(_raw_read_lock_wait_flags); | ||
147 | |||
127 | int _raw_read_trylock_retry(raw_rwlock_t *rw) | 148 | int _raw_read_trylock_retry(raw_rwlock_t *rw) |
128 | { | 149 | { |
129 | unsigned int old; | 150 | unsigned int old; |
@@ -157,6 +178,25 @@ void _raw_write_lock_wait(raw_rwlock_t *rw) | |||
157 | } | 178 | } |
158 | EXPORT_SYMBOL(_raw_write_lock_wait); | 179 | EXPORT_SYMBOL(_raw_write_lock_wait); |
159 | 180 | ||
181 | void _raw_write_lock_wait_flags(raw_rwlock_t *rw, unsigned long flags) | ||
182 | { | ||
183 | int count = spin_retry; | ||
184 | |||
185 | local_irq_restore(flags); | ||
186 | while (1) { | ||
187 | if (count-- <= 0) { | ||
188 | _raw_yield(); | ||
189 | count = spin_retry; | ||
190 | } | ||
191 | if (!__raw_write_can_lock(rw)) | ||
192 | continue; | ||
193 | local_irq_disable(); | ||
194 | if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) | ||
195 | return; | ||
196 | } | ||
197 | } | ||
198 | EXPORT_SYMBOL(_raw_write_lock_wait_flags); | ||
199 | |||
160 | int _raw_write_trylock_retry(raw_rwlock_t *rw) | 200 | int _raw_write_trylock_retry(raw_rwlock_t *rw) |
161 | { | 201 | { |
162 | int count = spin_retry; | 202 | int count = spin_retry; |