Lines Matching refs:test_var
301 static long test_var; variable
328 static noinline void test_kernel_read(void) { sink_value(test_var); } in test_kernel_read()
332 test_var = READ_ONCE_NOCHECK(test_sink) + 1; in test_kernel_write()
335 static noinline void test_kernel_write_nochange(void) { test_var = 42; } in test_kernel_write_nochange()
338 static noinline void test_kernel_write_nochange_rcu(void) { test_var = 42; } in test_kernel_write_nochange_rcu()
342 sink_value(READ_ONCE(test_var)); in test_kernel_read_atomic()
347 WRITE_ONCE(test_var, READ_ONCE_NOCHECK(test_sink) + 1); in test_kernel_write_atomic()
353 __atomic_fetch_add(&test_var, 1, __ATOMIC_RELAXED); in test_kernel_atomic_rmw()
357 static noinline void test_kernel_write_uninstrumented(void) { test_var++; } in test_kernel_write_uninstrumented()
359 static noinline void test_kernel_data_race(void) { data_race(test_var++); } in test_kernel_data_race()
363 ASSERT_EXCLUSIVE_WRITER(test_var); in test_kernel_assert_writer()
368 ASSERT_EXCLUSIVE_ACCESS(test_var); in test_kernel_assert_access()
381 test_var ^= TEST_CHANGE_BITS; in test_kernel_change_bits()
384 WRITE_ONCE(test_var, READ_ONCE(test_var) ^ TEST_CHANGE_BITS); in test_kernel_change_bits()
389 ASSERT_EXCLUSIVE_BITS(test_var, TEST_CHANGE_BITS); in test_kernel_assert_bits_change()
394 ASSERT_EXCLUSIVE_BITS(test_var, ~TEST_CHANGE_BITS); in test_kernel_assert_bits_nochange()
412 ASSERT_EXCLUSIVE_WRITER_SCOPED(test_var); in test_kernel_assert_writer_scoped()
418 ASSERT_EXCLUSIVE_ACCESS_SCOPED(test_var); in test_kernel_assert_access_scoped()
459 sink_value(test_var); in test_kernel_seqlock_reader()
468 test_var++; in test_kernel_seqlock_writer()
478 __atomic_load_n(&test_var, __ATOMIC_RELAXED); in test_kernel_atomic_builtins()
485 test_var ^= 0x10000; in test_kernel_xor_1bit()
497 test_var++; \
541 reorder_access->size = sizeof(test_var); \ in test_barrier_nothreads()
544 order_before ? 0 : sizeof(test_var), \ in test_barrier_nothreads()
561 test_var = 0; in test_barrier_nothreads()
562 while (test_var++ < 1000000 && reorder_access->size != sizeof(test_var)) in test_barrier_nothreads()
563 __kcsan_check_read(&test_var, sizeof(test_var)); in test_barrier_nothreads()
564 KUNIT_ASSERT_EQ(test, reorder_access->size, sizeof(test_var)); in test_barrier_nothreads()
579 KCSAN_EXPECT_READ_BARRIER(smp_store_mb(test_var, 0), true); in test_barrier_nothreads()
580 KCSAN_EXPECT_READ_BARRIER(smp_load_acquire(&test_var), false); in test_barrier_nothreads()
581 KCSAN_EXPECT_READ_BARRIER(smp_store_release(&test_var, 0), true); in test_barrier_nothreads()
582 KCSAN_EXPECT_READ_BARRIER(xchg(&test_var, 0), true); in test_barrier_nothreads()
583 KCSAN_EXPECT_READ_BARRIER(xchg_release(&test_var, 0), true); in test_barrier_nothreads()
584 KCSAN_EXPECT_READ_BARRIER(xchg_relaxed(&test_var, 0), false); in test_barrier_nothreads()
585 KCSAN_EXPECT_READ_BARRIER(cmpxchg(&test_var, 0, 0), true); in test_barrier_nothreads()
586 KCSAN_EXPECT_READ_BARRIER(cmpxchg_release(&test_var, 0, 0), true); in test_barrier_nothreads()
587 KCSAN_EXPECT_READ_BARRIER(cmpxchg_relaxed(&test_var, 0, 0), false); in test_barrier_nothreads()
601 KCSAN_EXPECT_READ_BARRIER(test_and_set_bit(0, &test_var), true); in test_barrier_nothreads()
602 KCSAN_EXPECT_READ_BARRIER(test_and_clear_bit(0, &test_var), true); in test_barrier_nothreads()
603 KCSAN_EXPECT_READ_BARRIER(test_and_change_bit(0, &test_var), true); in test_barrier_nothreads()
604 KCSAN_EXPECT_READ_BARRIER(clear_bit_unlock(0, &test_var), true); in test_barrier_nothreads()
605 KCSAN_EXPECT_READ_BARRIER(__clear_bit_unlock(0, &test_var), true); in test_barrier_nothreads()
624 KCSAN_EXPECT_WRITE_BARRIER(smp_store_mb(test_var, 0), true); in test_barrier_nothreads()
625 KCSAN_EXPECT_WRITE_BARRIER(smp_load_acquire(&test_var), false); in test_barrier_nothreads()
626 KCSAN_EXPECT_WRITE_BARRIER(smp_store_release(&test_var, 0), true); in test_barrier_nothreads()
627 KCSAN_EXPECT_WRITE_BARRIER(xchg(&test_var, 0), true); in test_barrier_nothreads()
628 KCSAN_EXPECT_WRITE_BARRIER(xchg_release(&test_var, 0), true); in test_barrier_nothreads()
629 KCSAN_EXPECT_WRITE_BARRIER(xchg_relaxed(&test_var, 0), false); in test_barrier_nothreads()
630 KCSAN_EXPECT_WRITE_BARRIER(cmpxchg(&test_var, 0, 0), true); in test_barrier_nothreads()
631 KCSAN_EXPECT_WRITE_BARRIER(cmpxchg_release(&test_var, 0, 0), true); in test_barrier_nothreads()
632 KCSAN_EXPECT_WRITE_BARRIER(cmpxchg_relaxed(&test_var, 0, 0), false); in test_barrier_nothreads()
646 KCSAN_EXPECT_WRITE_BARRIER(test_and_set_bit(0, &test_var), true); in test_barrier_nothreads()
647 KCSAN_EXPECT_WRITE_BARRIER(test_and_clear_bit(0, &test_var), true); in test_barrier_nothreads()
648 KCSAN_EXPECT_WRITE_BARRIER(test_and_change_bit(0, &test_var), true); in test_barrier_nothreads()
649 KCSAN_EXPECT_WRITE_BARRIER(clear_bit_unlock(0, &test_var), true); in test_barrier_nothreads()
650 KCSAN_EXPECT_WRITE_BARRIER(__clear_bit_unlock(0, &test_var), true); in test_barrier_nothreads()
669 KCSAN_EXPECT_RW_BARRIER(smp_store_mb(test_var, 0), true); in test_barrier_nothreads()
670 KCSAN_EXPECT_RW_BARRIER(smp_load_acquire(&test_var), false); in test_barrier_nothreads()
671 KCSAN_EXPECT_RW_BARRIER(smp_store_release(&test_var, 0), true); in test_barrier_nothreads()
672 KCSAN_EXPECT_RW_BARRIER(xchg(&test_var, 0), true); in test_barrier_nothreads()
673 KCSAN_EXPECT_RW_BARRIER(xchg_release(&test_var, 0), true); in test_barrier_nothreads()
674 KCSAN_EXPECT_RW_BARRIER(xchg_relaxed(&test_var, 0), false); in test_barrier_nothreads()
675 KCSAN_EXPECT_RW_BARRIER(cmpxchg(&test_var, 0, 0), true); in test_barrier_nothreads()
676 KCSAN_EXPECT_RW_BARRIER(cmpxchg_release(&test_var, 0, 0), true); in test_barrier_nothreads()
677 KCSAN_EXPECT_RW_BARRIER(cmpxchg_relaxed(&test_var, 0, 0), false); in test_barrier_nothreads()
691 KCSAN_EXPECT_RW_BARRIER(test_and_set_bit(0, &test_var), true); in test_barrier_nothreads()
692 KCSAN_EXPECT_RW_BARRIER(test_and_clear_bit(0, &test_var), true); in test_barrier_nothreads()
693 KCSAN_EXPECT_RW_BARRIER(test_and_change_bit(0, &test_var), true); in test_barrier_nothreads()
694 KCSAN_EXPECT_RW_BARRIER(clear_bit_unlock(0, &test_var), true); in test_barrier_nothreads()
695 KCSAN_EXPECT_RW_BARRIER(__clear_bit_unlock(0, &test_var), true); in test_barrier_nothreads()
704 KCSAN_EXPECT_READ_BARRIER(clear_bit_unlock_is_negative_byte(0, &test_var), true); in test_barrier_nothreads()
705 KCSAN_EXPECT_WRITE_BARRIER(clear_bit_unlock_is_negative_byte(0, &test_var), true); in test_barrier_nothreads()
706 KCSAN_EXPECT_RW_BARRIER(clear_bit_unlock_is_negative_byte(0, &test_var), true); in test_barrier_nothreads()
717 { test_kernel_write, &test_var, sizeof(test_var), KCSAN_ACCESS_WRITE }, in test_basic()
718 { test_kernel_read, &test_var, sizeof(test_var), 0 }, in test_basic()
723 { test_kernel_read, &test_var, sizeof(test_var), 0 }, in test_basic()
724 { test_kernel_read, &test_var, sizeof(test_var), 0 }, in test_basic()
777 { test_kernel_write_nochange, &test_var, sizeof(test_var), KCSAN_ACCESS_WRITE }, in test_novalue_change()
778 { test_kernel_read, &test_var, sizeof(test_var), 0 }, in test_novalue_change()
783 { test_kernel_write_nochange, &test_var, sizeof(test_var), KCSAN_ACCESS_WRITE }, in test_novalue_change()
784 { test_kernel_write_nochange, &test_var, sizeof(test_var), KCSAN_ACCESS_WRITE }, in test_novalue_change()
809 { test_kernel_write_nochange_rcu, &test_var, sizeof(test_var), KCSAN_ACCESS_WRITE }, in test_novalue_change_exception()
810 { test_kernel_read, &test_var, sizeof(test_var), 0 }, in test_novalue_change_exception()
815 { test_kernel_write_nochange_rcu, &test_var, sizeof(test_var), KCSAN_ACCESS_WRITE }, in test_novalue_change_exception()
816 { test_kernel_write_nochange_rcu, &test_var, sizeof(test_var), KCSAN_ACCESS_WRITE }, in test_novalue_change_exception()
835 { test_kernel_read, &test_var, sizeof(test_var), 0 }, in test_unknown_origin()
857 { test_kernel_write, &test_var, sizeof(test_var), KCSAN_ACCESS_WRITE }, in test_write_write_assume_atomic()
858 { test_kernel_write, &test_var, sizeof(test_var), KCSAN_ACCESS_WRITE }, in test_write_write_assume_atomic()
865 sink_value(READ_ONCE(test_var)); /* induce value-change */ in test_write_write_assume_atomic()
937 { test_kernel_read, &test_var, sizeof(test_var), 0 }, in test_read_plain_atomic_write()
938 …{ test_kernel_write_atomic, &test_var, sizeof(test_var), KCSAN_ACCESS_WRITE | KCSAN_ACCESS_ATOMIC … in test_read_plain_atomic_write()
958 { test_kernel_read, &test_var, sizeof(test_var), 0 }, in test_read_plain_atomic_rmw()
959 { test_kernel_atomic_rmw, &test_var, sizeof(test_var), in test_read_plain_atomic_rmw()
1020 { test_kernel_assert_writer, &test_var, sizeof(test_var), KCSAN_ACCESS_ASSERT }, in test_assert_exclusive_writer()
1021 { test_kernel_write_nochange, &test_var, sizeof(test_var), KCSAN_ACCESS_WRITE }, in test_assert_exclusive_writer()
1038 …{ test_kernel_assert_access, &test_var, sizeof(test_var), KCSAN_ACCESS_ASSERT | KCSAN_ACCESS_WRITE… in test_assert_exclusive_access()
1039 { test_kernel_read, &test_var, sizeof(test_var), 0 }, in test_assert_exclusive_access()
1056 …{ test_kernel_assert_access, &test_var, sizeof(test_var), KCSAN_ACCESS_ASSERT | KCSAN_ACCESS_WRITE… in test_assert_exclusive_access_writer()
1057 { test_kernel_assert_writer, &test_var, sizeof(test_var), KCSAN_ACCESS_ASSERT }, in test_assert_exclusive_access_writer()
1062 …{ test_kernel_assert_access, &test_var, sizeof(test_var), KCSAN_ACCESS_ASSERT | KCSAN_ACCESS_WRITE… in test_assert_exclusive_access_writer()
1063 …{ test_kernel_assert_access, &test_var, sizeof(test_var), KCSAN_ACCESS_ASSERT | KCSAN_ACCESS_WRITE… in test_assert_exclusive_access_writer()
1068 { test_kernel_assert_writer, &test_var, sizeof(test_var), KCSAN_ACCESS_ASSERT }, in test_assert_exclusive_access_writer()
1069 { test_kernel_assert_writer, &test_var, sizeof(test_var), KCSAN_ACCESS_ASSERT }, in test_assert_exclusive_access_writer()
1092 { test_kernel_assert_bits_change, &test_var, sizeof(test_var), KCSAN_ACCESS_ASSERT }, in test_assert_exclusive_bits_change()
1093 { test_kernel_change_bits, &test_var, sizeof(test_var), in test_assert_exclusive_bits_change()
1123 …{ test_kernel_assert_writer_scoped, &test_var, sizeof(test_var), KCSAN_ACCESS_ASSERT | KCSAN_ACCES… in test_assert_exclusive_writer_scoped()
1124 { test_kernel_write_nochange, &test_var, sizeof(test_var), KCSAN_ACCESS_WRITE }, in test_assert_exclusive_writer_scoped()
1129 { test_enter_scope, &test_var, sizeof(test_var), KCSAN_ACCESS_ASSERT | KCSAN_ACCESS_SCOPED }, in test_assert_exclusive_writer_scoped()
1130 { test_kernel_write_nochange, &test_var, sizeof(test_var), KCSAN_ACCESS_WRITE }, in test_assert_exclusive_writer_scoped()
1150 …{ test_kernel_assert_access_scoped, &test_var, sizeof(test_var), KCSAN_ACCESS_ASSERT | KCSAN_ACCES… in test_assert_exclusive_access_scoped()
1151 { test_kernel_read, &test_var, sizeof(test_var), 0 }, in test_assert_exclusive_access_scoped()
1159 …{ test_enter_scope, &test_var, sizeof(test_var), KCSAN_ACCESS_ASSERT | KCSAN_ACCESS_WRITE | KCSAN_… in test_assert_exclusive_access_scoped()
1160 { test_kernel_read, &test_var, sizeof(test_var), 0 }, in test_assert_exclusive_access_scoped()
1223 __atomic_store_n(&test_var, 42L, __ATOMIC_RELAXED); in test_atomic_builtins()
1224 KUNIT_EXPECT_EQ(test, 42L, __atomic_load_n(&test_var, __ATOMIC_RELAXED)); in test_atomic_builtins()
1226 KUNIT_EXPECT_EQ(test, 42L, __atomic_exchange_n(&test_var, 20, __ATOMIC_RELAXED)); in test_atomic_builtins()
1227 KUNIT_EXPECT_EQ(test, 20L, test_var); in test_atomic_builtins()
1230 KUNIT_EXPECT_TRUE(test, __atomic_compare_exchange_n(&test_var, &tmp, 30L, in test_atomic_builtins()
1234 KUNIT_EXPECT_EQ(test, test_var, 30L); in test_atomic_builtins()
1235 KUNIT_EXPECT_FALSE(test, __atomic_compare_exchange_n(&test_var, &tmp, 40L, in test_atomic_builtins()
1239 KUNIT_EXPECT_EQ(test, test_var, 30L); in test_atomic_builtins()
1241 KUNIT_EXPECT_EQ(test, 30L, __atomic_fetch_add(&test_var, 1, __ATOMIC_RELAXED)); in test_atomic_builtins()
1242 KUNIT_EXPECT_EQ(test, 31L, __atomic_fetch_sub(&test_var, 1, __ATOMIC_RELAXED)); in test_atomic_builtins()
1243 KUNIT_EXPECT_EQ(test, 30L, __atomic_fetch_and(&test_var, 0xf, __ATOMIC_RELAXED)); in test_atomic_builtins()
1244 KUNIT_EXPECT_EQ(test, 14L, __atomic_fetch_xor(&test_var, 0xf, __ATOMIC_RELAXED)); in test_atomic_builtins()
1245 KUNIT_EXPECT_EQ(test, 1L, __atomic_fetch_or(&test_var, 0xf0, __ATOMIC_RELAXED)); in test_atomic_builtins()
1246 KUNIT_EXPECT_EQ(test, 241L, __atomic_fetch_nand(&test_var, 0xf, __ATOMIC_RELAXED)); in test_atomic_builtins()
1247 KUNIT_EXPECT_EQ(test, -2L, test_var); in test_atomic_builtins()
1264 { test_kernel_read, &test_var, sizeof(test_var), 0 }, in test_1bit_value_change()
1265 { test_kernel_xor_1bit, &test_var, sizeof(test_var), __KCSAN_ACCESS_RW(KCSAN_ACCESS_WRITE) }, in test_1bit_value_change()
1287 … { test_kernel_with_memorder, &test_var, sizeof(test_var), __KCSAN_ACCESS_RW(KCSAN_ACCESS_WRITE) }, in test_correct_barrier()
1288 { test_kernel_with_memorder, &test_var, sizeof(test_var), __KCSAN_ACCESS_RW(0) }, in test_correct_barrier()
1306 …{ test_kernel_wrong_memorder, &test_var, sizeof(test_var), __KCSAN_ACCESS_RW(KCSAN_ACCESS_WRITE) }, in test_missing_barrier()
1307 { test_kernel_wrong_memorder, &test_var, sizeof(test_var), __KCSAN_ACCESS_RW(0) }, in test_missing_barrier()
1328 …{ test_kernel_atomic_builtin_with_memorder, &test_var, sizeof(test_var), __KCSAN_ACCESS_RW(KCSAN_A… in test_atomic_builtins_correct_barrier()
1329 { test_kernel_atomic_builtin_with_memorder, &test_var, sizeof(test_var), __KCSAN_ACCESS_RW(0) }, in test_atomic_builtins_correct_barrier()
1348 …{ test_kernel_atomic_builtin_wrong_memorder, &test_var, sizeof(test_var), __KCSAN_ACCESS_RW(KCSAN_… in test_atomic_builtins_missing_barrier()
1349 { test_kernel_atomic_builtin_wrong_memorder, &test_var, sizeof(test_var), __KCSAN_ACCESS_RW(0) }, in test_atomic_builtins_missing_barrier()