35 lines
1.0 KiB
Diff
35 lines
1.0 KiB
Diff
From 7b1afc72dc9ffe79d60dad4c395b0f7c7010ec22 Mon Sep 17 00:00:00 2001
|
|
From: Wenkai Lin <linwenkai6@hisilicon.com>
|
|
Date: Tue, 23 Jul 2024 19:39:06 +0800
|
|
Subject: [PATCH 03/16] uadk/v1: fix for atomic memory order
|
|
|
|
If the memory order of the atomic operation is used improperly,
|
|
an exception occurs in multiple threads.
|
|
The load operation should use __ATOMIC_ACQUIRE, all memory access
|
|
operations of the current thread cannot be reordered before this
|
|
instruction, which is visible to the store operation (release)
|
|
of other threads.
|
|
|
|
Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com>
|
|
Signed-off-by: Qi Tao <taoqi10@huawei.com>
|
|
---
|
|
v1/wd_util.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/v1/wd_util.c b/v1/wd_util.c
|
|
index d441805..f44da99 100644
|
|
--- a/v1/wd_util.c
|
|
+++ b/v1/wd_util.c
|
|
@@ -25,7 +25,7 @@
|
|
void wd_spinlock(struct wd_lock *lock)
|
|
{
|
|
while (__atomic_test_and_set(&lock->lock, __ATOMIC_ACQUIRE))
|
|
- while (__atomic_load_n(&lock->lock, __ATOMIC_RELAXED))
|
|
+ while (__atomic_load_n(&lock->lock, __ATOMIC_ACQUIRE))
|
|
;
|
|
}
|
|
|
|
--
|
|
2.25.1
|
|
|