Skip to contentSkip to conversation

tools: fix atomic_set() definition to set the value correctly

PATCH Applied Suren Baghdasaryan 2 participants 2 messages Dec 27, 2024 – Jan 2, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: fix atomic_set() definition to set the value correctly

Currently vma test is failing because of the new vma_assert_attached() assertion. The check is failing because previous refcount_set() inside vma_mark_attached() is a NoOp. Fix the definition of atomic_set() to correctly set the value of the atomic.

Fixes 9325b8b5a1cb ("tools: add skeleton code for userland testing of VMA logic")

---
Applies over mm-unstable

 tools/testing/shared/linux/maple_tree.h | 2 +-
 tools/testing/vma/linux/atomic.h        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/testing/shared/linux/maple_tree.h +1 -1
index 06c89bdcc515..f67d47d32857 100644
@@ -2,6 +2,6 @@
 #define atomic_t int32_t
 #define atomic_inc(x) uatomic_inc(x)
 #define atomic_read(x) uatomic_read(x)
-#define atomic_set(x, y) do {} while (0)
+#define atomic_set(x, y) uatomic_set(x, y)
 #define U8_MAX UCHAR_MAX
 #include "../../../../include/linux/maple_tree.h"
tools/testing/vma/linux/atomic.h +1 -1
index 2e2021553196..788c597c4fde 100644
@@ -6,7 +6,7 @@
 #define atomic_t int32_t
 #define atomic_inc(x) uatomic_inc(x)
 #define atomic_read(x) uatomic_read(x)
-#define atomic_set(x, y) do {} while (0)
+#define atomic_set(x, y) uatomic_set(x, y)
 #define U8_MAX UCHAR_MAX
 
 #ifndef atomic_cmpxchg_relaxed
Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Suren Baghdasaryan

Currently vma test is failing because of the new vma_assert_attached() assertion. The check is failing because previous refcount_set() inside vma_mark_attached() is a NoOp. Fix the definition of atomic_set() to correctly set the value of the atomic.

Fixes 9325b8b5a1cb ("tools: add skeleton code for userland testing of VMA logic")

LGTM:

Quoted 35 lines

---
Applies over mm-unstable

 tools/testing/shared/linux/maple_tree.h | 2 +-
 tools/testing/vma/linux/atomic.h        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/testing/shared/linux/maple_tree.h +1 -1
index 06c89bdcc515..f67d47d32857 100644
@@ -2,6 +2,6 @@
 #define atomic_t int32_t
 #define atomic_inc(x) uatomic_inc(x)
 #define atomic_read(x) uatomic_read(x)
-#define atomic_set(x, y) do {} while (0)
+#define atomic_set(x, y) uatomic_set(x, y)
 #define U8_MAX UCHAR_MAX
 #include "../../../../include/linux/maple_tree.h"
tools/testing/vma/linux/atomic.h +1 -2
index 2e2021553196..788c597c4fde 100644
@@ -6,7 +6,7 @@
 #define atomic_t int32_t
 #define atomic_inc(x) uatomic_inc(x)
 #define atomic_read(x) uatomic_read(x)
-#define atomic_set(x, y) do {} while (0)
+#define atomic_set(x, y) uatomic_set(x, y)
 #define U8_MAX UCHAR_MAX
 
 #ifndef atomic_cmpxchg_relaxed
--

2.47.1.613.gc27f4b7a9f-goog