diff options
Diffstat (limited to 'arch/s390/lib/spinlock.c')
-rw-r--r-- | arch/s390/lib/spinlock.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c index 8d76403fcf89..e41f4008afc5 100644 --- a/arch/s390/lib/spinlock.c +++ b/arch/s390/lib/spinlock.c | |||
@@ -39,7 +39,7 @@ static inline void _raw_yield_cpu(int cpu) | |||
39 | _raw_yield(); | 39 | _raw_yield(); |
40 | } | 40 | } |
41 | 41 | ||
42 | void _raw_spin_lock_wait(raw_spinlock_t *lp, unsigned int pc) | 42 | void _raw_spin_lock_wait(raw_spinlock_t *lp) |
43 | { | 43 | { |
44 | int count = spin_retry; | 44 | int count = spin_retry; |
45 | unsigned int cpu = ~smp_processor_id(); | 45 | unsigned int cpu = ~smp_processor_id(); |
@@ -53,15 +53,36 @@ void _raw_spin_lock_wait(raw_spinlock_t *lp, unsigned int pc) | |||
53 | } | 53 | } |
54 | if (__raw_spin_is_locked(lp)) | 54 | if (__raw_spin_is_locked(lp)) |
55 | continue; | 55 | continue; |
56 | if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0) { | 56 | if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0) |
57 | lp->owner_pc = pc; | ||
58 | return; | 57 | return; |
59 | } | ||
60 | } | 58 | } |
61 | } | 59 | } |
62 | EXPORT_SYMBOL(_raw_spin_lock_wait); | 60 | EXPORT_SYMBOL(_raw_spin_lock_wait); |
63 | 61 | ||
64 | int _raw_spin_trylock_retry(raw_spinlock_t *lp, unsigned int pc) | 62 | void _raw_spin_lock_wait_flags(raw_spinlock_t *lp, unsigned long flags) |
63 | { | ||
64 | int count = spin_retry; | ||
65 | unsigned int cpu = ~smp_processor_id(); | ||
66 | |||
67 | local_irq_restore(flags); | ||
68 | while (1) { | ||
69 | if (count-- <= 0) { | ||
70 | unsigned int owner = lp->owner_cpu; | ||
71 | if (owner != 0) | ||
72 | _raw_yield_cpu(~owner); | ||
73 | count = spin_retry; | ||
74 | } | ||
75 | if (__raw_spin_is_locked(lp)) | ||
76 | continue; | ||
77 | local_irq_disable(); | ||
78 | if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0) | ||
79 | return; | ||
80 | local_irq_restore(flags); | ||
81 | } | ||
82 | } | ||
83 | EXPORT_SYMBOL(_raw_spin_lock_wait_flags); | ||
84 | |||
85 | int _raw_spin_trylock_retry(raw_spinlock_t *lp) | ||
65 | { | 86 | { |
66 | unsigned int cpu = ~smp_processor_id(); | 87 | unsigned int cpu = ~smp_processor_id(); |
67 | int count; | 88 | int count; |
@@ -69,10 +90,8 @@ int _raw_spin_trylock_retry(raw_spinlock_t *lp, unsigned int pc) | |||
69 | for (count = spin_retry; count > 0; count--) { | 90 | for (count = spin_retry; count > 0; count--) { |
70 | if (__raw_spin_is_locked(lp)) | 91 | if (__raw_spin_is_locked(lp)) |
71 | continue; | 92 | continue; |
72 | if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0) { | 93 | if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0) |
73 | lp->owner_pc = pc; | ||
74 | return 1; | 94 | return 1; |
75 | } | ||
76 | } | 95 | } |
77 | return 0; | 96 | return 0; |
78 | } | 97 | } |