From e1f71f988b4e8733c0c0139135d8f50d6e548183 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com> Date: Thu, 21 Dec 2017 17:26:36 +0900 Subject: [PATCH] sched/semaphore/spinlock.c: Add memory barrier operations in spin_unlock() In ARM document regarding memory barrires, SP_DMB() must be issued before changing a spinlock state to SP_UNLOCKED. However, we found that SP_DSB() is also needed to ensure that spin_unlock() works correctly for network streaming aging test. Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com> --- sched/semaphore/spinlock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sched/semaphore/spinlock.c b/sched/semaphore/spinlock.c index fc46f05aae..674ebb6b52 100644 --- a/sched/semaphore/spinlock.c +++ b/sched/semaphore/spinlock.c @@ -165,8 +165,9 @@ void spin_unlock(FAR volatile spinlock_t *lock) sched_note_spinunlock(this_task(), lock); #endif - *lock = SP_UNLOCKED; SP_DMB(); + *lock = SP_UNLOCKED; + SP_DSB(); } #endif -- GitLab