lib: test: disable TSA for spinlock tests

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@gmail.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20260909162322.29778-15-carlos.lopezr4096@gmail.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Carlos López
2026-09-16 09:48:30 +05:30
committed by Anup Patel
parent 8f80b2651f
commit 92b24d6acb
+3
View File
@@ -4,6 +4,7 @@
static spinlock_t test_lock = SPIN_LOCK_INITIALIZER; static spinlock_t test_lock = SPIN_LOCK_INITIALIZER;
static void spin_lock_test(struct sbiunit_test_case *test) static void spin_lock_test(struct sbiunit_test_case *test)
NO_THREAD_SAFETY_ANALYSIS
{ {
/* We don't want to accidentally get locked */ /* We don't want to accidentally get locked */
SBIUNIT_ASSERT(test, !spin_lock_check(&test_lock)); 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) static void spin_trylock_fail(struct sbiunit_test_case *test)
NO_THREAD_SAFETY_ANALYSIS
{ {
/* We don't want to accidentally get locked */ /* We don't want to accidentally get locked */
SBIUNIT_ASSERT(test, !spin_lock_check(&test_lock)); 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) static void spin_trylock_success(struct sbiunit_test_case *test)
NO_THREAD_SAFETY_ANALYSIS
{ {
SBIUNIT_EXPECT(test, spin_trylock(&test_lock)); SBIUNIT_EXPECT(test, spin_trylock(&test_lock));
spin_unlock(&test_lock); spin_unlock(&test_lock);