ARM: Add smp barriers to mutex fastpath routines
For smp, barriers are required when a mutex lock is acquired or released. Mutex slowpath routines already contain the necessary barriers. Change-Id: I774fc6e7bd5b1db9a0f51dee456b71c569cd512e Signed-off-by: Brent DeGraaf <bdegraaf@codeaurora.org> (cherry picked from commit 62c6b43d05a6aab278eb7d5d0030bd731b7684ea)
This commit is contained in:
committed by
Stephen Boyd
parent
d00d32eb28
commit
94782bc2a8
@@ -41,6 +41,8 @@ __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
|
||||
__res |= __ex_flag;
|
||||
if (unlikely(__res != 0))
|
||||
fail_fn(count);
|
||||
else
|
||||
smp_rmb();
|
||||
}
|
||||
|
||||
static inline int
|
||||
@@ -61,6 +63,9 @@ __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
|
||||
__res |= __ex_flag;
|
||||
if (unlikely(__res != 0))
|
||||
__res = fail_fn(count);
|
||||
else
|
||||
smp_rmb();
|
||||
|
||||
return __res;
|
||||
}
|
||||
|
||||
@@ -74,6 +79,7 @@ __mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
|
||||
{
|
||||
int __ex_flag, __res, __orig;
|
||||
|
||||
smp_wmb();
|
||||
__asm__ (
|
||||
|
||||
"ldrex %0, [%3] \n\t"
|
||||
@@ -119,6 +125,8 @@ __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
|
||||
: "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag)
|
||||
: "r" (&count->counter)
|
||||
: "cc", "memory" );
|
||||
if (__orig)
|
||||
smp_rmb();
|
||||
|
||||
return __orig;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user