[PATCH 13/14] lib: test: disable TSA for spinlock tests
Carlos López
carlos.lopezr4096 at gmail.com
Wed Jul 29 09:35:40 PDT 2026
The spinlock tests deliberately use unconventional locking patterns to
test edge cases. Disable thread safety analysis for them so that they
don't generate false positives when the feature is enabled.
Signed-off-by: Carlos López <carlos.lopezr4096 at gmail.com>
---
lib/sbi/tests/riscv_locks_test.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/sbi/tests/riscv_locks_test.c b/lib/sbi/tests/riscv_locks_test.c
index 7894c4e9873c..2cbba3da8b6b 100644
--- a/lib/sbi/tests/riscv_locks_test.c
+++ b/lib/sbi/tests/riscv_locks_test.c
@@ -4,6 +4,7 @@
static spinlock_t test_lock = SPIN_LOCK_INITIALIZER;
static void spin_lock_test(struct sbiunit_test_case *test)
+ NO_THREAD_SAFETY_ANALYSIS
{
/* We don't want to accidentally get locked */
SBIUNIT_ASSERT(test, !spin_lock_check(&test_lock));
@@ -16,6 +17,7 @@ static void spin_lock_test(struct sbiunit_test_case *test)
}
static void spin_trylock_fail(struct sbiunit_test_case *test)
+ NO_THREAD_SAFETY_ANALYSIS
{
/* We don't want to accidentally get locked */
SBIUNIT_ASSERT(test, !spin_lock_check(&test_lock));
@@ -26,6 +28,7 @@ static void spin_trylock_fail(struct sbiunit_test_case *test)
}
static void spin_trylock_success(struct sbiunit_test_case *test)
+ NO_THREAD_SAFETY_ANALYSIS
{
SBIUNIT_EXPECT(test, spin_trylock(&test_lock));
spin_unlock(&test_lock);
--
2.51.0
More information about the opensbi
mailing list