39 lines
1.2 KiB
Diff
39 lines
1.2 KiB
Diff
From a6af8f8829abad50eefa712840a6b1e65e7fb93e Mon Sep 17 00:00:00 2001
|
|
From: David Hildenbrand <dahi@linux.vnet.ibm.com>
|
|
Date: Mon, 11 May 2015 17:52:15 +0200
|
|
Subject: [PATCH 10/14] arm/futex: UP futex_atomic_cmpxchg_inatomic() relies on
|
|
disabled preemption
|
|
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.0/patches-4.0.4-rt1.tar.xz
|
|
|
|
The !CONFIG_SMP implementation of futex_atomic_cmpxchg_inatomic()
|
|
requires preemption to be disabled to guarantee mutual exclusion.
|
|
Let's make this explicit.
|
|
|
|
This patch is based on a patch by Sebastian Andrzej Siewior on the
|
|
-rt branch.
|
|
|
|
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
|
|
---
|
|
arch/arm/include/asm/futex.h | 3 +++
|
|
1 file changed, 3 insertions(+)
|
|
|
|
--- a/arch/arm/include/asm/futex.h
|
|
+++ b/arch/arm/include/asm/futex.h
|
|
@@ -93,6 +93,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval,
|
|
if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
|
|
return -EFAULT;
|
|
|
|
+ preempt_disable();
|
|
__asm__ __volatile__("@futex_atomic_cmpxchg_inatomic\n"
|
|
"1: " TUSER(ldr) " %1, [%4]\n"
|
|
" teq %1, %2\n"
|
|
@@ -104,6 +105,8 @@ futex_atomic_cmpxchg_inatomic(u32 *uval,
|
|
: "cc", "memory");
|
|
|
|
*uval = val;
|
|
+ preempt_enable();
|
|
+
|
|
return ret;
|
|
}
|
|
|