Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 973bd993 authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Linus Torvalds
Browse files

[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: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8d93c700
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ kexec_halt_all_cpus(void *kernel_image)
		pfault_fini();
#endif

	if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid))
	if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) != -1)
		signal_processor(smp_processor_id(), sigp_stop);

	/* Wait for all other cpus to enter stopped state */
+3 −3
Original line number Diff line number Diff line
@@ -263,7 +263,7 @@ static void do_machine_restart(void * __unused)
	int cpu;
	static atomic_t cpuid = ATOMIC_INIT(-1);

	if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid))
	if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) != -1)
		signal_processor(smp_processor_id(), sigp_stop);

	/* Wait for all other cpus to enter stopped state */
@@ -313,7 +313,7 @@ static void do_machine_halt(void * __unused)
{
	static atomic_t cpuid = ATOMIC_INIT(-1);

	if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid) == 0) {
	if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) == -1) {
		smp_send_stop();
		if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0)
			cpcmd(vmhalt_cmd, NULL, 0, NULL);
@@ -332,7 +332,7 @@ static void do_machine_power_off(void * __unused)
{
	static atomic_t cpuid = ATOMIC_INIT(-1);

	if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid) == 0) {
	if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) == -1) {
		smp_send_stop();
		if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0)
			cpcmd(vmpoff_cmd, NULL, 0, NULL);
+2 −2
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
 * Bugreports.to..: <Linux390@de.ibm.com>
 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001
 *
 * $Revision: 1.167 $
 * $Revision: 1.169 $
 */

#include <linux/config.h>
@@ -1323,7 +1323,7 @@ void
dasd_schedule_bh(struct dasd_device * device)
{
	/* Protect against rescheduling. */
	if (atomic_compare_and_swap (0, 1, &device->tasklet_scheduled))
	if (atomic_cmpxchg (&device->tasklet_scheduled, 0, 1) != 0)
		return;
	dasd_get_device(device);
	tasklet_hi_schedule(&device->tasklet);
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ do_load_quiesce_psw(void * __unused)
	psw_t quiesce_psw;
	int cpu;

	if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid))
	if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) != -1)
		signal_processor(smp_processor_id(), sigp_stop);
	/* Wait for all other cpus to enter stopped state */
	for_each_online_cpu(cpu) {
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ static void
tapeblock_trigger_requeue(struct tape_device *device)
{
	/* Protect against rescheduling. */
	if (atomic_compare_and_swap(0, 1, &device->blk_data.requeue_scheduled))
	if (atomic_cmpxchg(&device->blk_data.requeue_scheduled, 0, 1) != 0)
		return;
	schedule_work(&device->blk_data.requeue_task);
}
Loading