diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2006-01-06 03:19:07 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:33:48 -0500 |
commit | 973bd9937569146de0917f54f05b2942f8257912 (patch) | |
tree | 86dd796de5bf456eca904b350c9515f4795122bb /arch | |
parent | 8d93c700a489eba08514222df414a23852a85d2b (diff) |
[PATCH] s390: atomic primitives
Hugh Dickins <hugh@veritas.com>
Fix the broken atomic_cmpxchg primitive. Add atomic_sub_and_test,
atomic64_sub_return, atomic64_sub_and_test, atomic64_cmpxchg,
atomic64_add_unless and atomic64_inc_not_zero. Replace old style
atomic_compare_and_swap by atomic_cmpxchg. Shorten the whole header by
defining most primitives with the two inline functions atomic_add_return and
atomic_sub_return.
In addition this patch contains the s390 related fixes of Hugh's "mm: fill
arch atomic64 gaps" patch.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/s390/kernel/machine_kexec.c | 2 | ||||
-rw-r--r-- | arch/s390/kernel/smp.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c index 5aa71b05b8ae..f0ed5c642c74 100644 --- a/arch/s390/kernel/machine_kexec.c +++ b/arch/s390/kernel/machine_kexec.c | |||
@@ -85,7 +85,7 @@ kexec_halt_all_cpus(void *kernel_image) | |||
85 | pfault_fini(); | 85 | pfault_fini(); |
86 | #endif | 86 | #endif |
87 | 87 | ||
88 | if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid)) | 88 | if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) != -1) |
89 | signal_processor(smp_processor_id(), sigp_stop); | 89 | signal_processor(smp_processor_id(), sigp_stop); |
90 | 90 | ||
91 | /* Wait for all other cpus to enter stopped state */ | 91 | /* Wait for all other cpus to enter stopped state */ |
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 5856b3fda6bf..bd5b311006be 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -263,7 +263,7 @@ static void do_machine_restart(void * __unused) | |||
263 | int cpu; | 263 | int cpu; |
264 | static atomic_t cpuid = ATOMIC_INIT(-1); | 264 | static atomic_t cpuid = ATOMIC_INIT(-1); |
265 | 265 | ||
266 | if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid)) | 266 | if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) != -1) |
267 | signal_processor(smp_processor_id(), sigp_stop); | 267 | signal_processor(smp_processor_id(), sigp_stop); |
268 | 268 | ||
269 | /* Wait for all other cpus to enter stopped state */ | 269 | /* Wait for all other cpus to enter stopped state */ |
@@ -313,7 +313,7 @@ static void do_machine_halt(void * __unused) | |||
313 | { | 313 | { |
314 | static atomic_t cpuid = ATOMIC_INIT(-1); | 314 | static atomic_t cpuid = ATOMIC_INIT(-1); |
315 | 315 | ||
316 | if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid) == 0) { | 316 | if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) == -1) { |
317 | smp_send_stop(); | 317 | smp_send_stop(); |
318 | if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0) | 318 | if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0) |
319 | cpcmd(vmhalt_cmd, NULL, 0, NULL); | 319 | cpcmd(vmhalt_cmd, NULL, 0, NULL); |
@@ -332,7 +332,7 @@ static void do_machine_power_off(void * __unused) | |||
332 | { | 332 | { |
333 | static atomic_t cpuid = ATOMIC_INIT(-1); | 333 | static atomic_t cpuid = ATOMIC_INIT(-1); |
334 | 334 | ||
335 | if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid) == 0) { | 335 | if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) == -1) { |
336 | smp_send_stop(); | 336 | smp_send_stop(); |
337 | if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0) | 337 | if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0) |
338 | cpcmd(vmpoff_cmd, NULL, 0, NULL); | 338 | cpcmd(vmpoff_cmd, NULL, 0, NULL); |