From 937f2a101abf737ac1b8753bca647b2850c4389e Mon Sep 17 00:00:00 2001 From: Philip Elcan Date: Thu, 30 May 2019 12:36:12 -0400 Subject: [PATCH] gpu: nvgpu: unit: atomics: increase reliability The test atomic_cmpxchg_not_atomic_threaded is failing intermittently. Increase the iterations to try to increase reliability. NVGPU-2251 Change-Id: Ib585321a28c21d073acac5b7b8509d3af55316b8 Signed-off-by: Philip Elcan Reviewed-on: https://git-master.nvidia.com/r/2127948 Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Nicolas Benech Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- userspace/units/interface/atomic/atomic.c | 32 ++++++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/userspace/units/interface/atomic/atomic.c b/userspace/units/interface/atomic/atomic.c index a91ae87ee..1546f491e 100644 --- a/userspace/units/interface/atomic/atomic.c +++ b/userspace/units/interface/atomic/atomic.c @@ -1431,7 +1431,31 @@ struct atomic_test_args xchg_64_arg = { .start_val = INT_MAX, .value = 1, .loop_count = 10000, - .repeat_count = 2000, /* for threaded test */ + .repeat_count = 10000, /* for threaded test */ +}; +struct atomic_test_args cmpxchg_not_atomic_arg = { + .op = op_cmpxchg, + .type = NOT_ATOMIC, + .start_val = 1, + .value = 1, + .loop_count = 10000, + .repeat_count = 50000, /* for threaded test */ +}; +struct atomic_test_args cmpxchg_32_arg = { + .op = op_cmpxchg, + .type = ATOMIC_32, + .start_val = 1, + .value = 1, + .loop_count = 10000, + .repeat_count = 50000, /* for threaded test */ +}; +struct atomic_test_args cmpxchg_64_arg = { + .op = op_cmpxchg, + .type = ATOMIC_64, + .start_val = INT_MAX, + .value = 1, + .loop_count = 10000, + .repeat_count = 50000, /* for threaded test */ }; static struct atomic_test_args add_unless_32_arg = { /* must loop at least 10 times */ @@ -1482,9 +1506,9 @@ struct unit_module_test atomic_tests[] = { UNIT_TEST(atomic_add_64_threaded, test_atomic_arithmetic_threaded, &add_64_arg, 0), UNIT_TEST(atomic_sub_32_threaded, test_atomic_arithmetic_threaded, &sub_32_arg, 0), UNIT_TEST(atomic_sub_64_threaded, test_atomic_arithmetic_threaded, &sub_64_arg, 0), - UNIT_TEST(atomic_cmpxchg_not_atomic_threaded, test_atomic_arithmetic_threaded, &xchg_not_atomic_arg, 0), - UNIT_TEST(atomic_cmpxchg_32_threaded, test_atomic_arithmetic_threaded, &xchg_32_arg, 0), - UNIT_TEST(atomic_cmpxchg_64_threaded, test_atomic_arithmetic_threaded, &xchg_64_arg, 0), + UNIT_TEST(atomic_cmpxchg_not_atomic_threaded, test_atomic_arithmetic_threaded, &cmpxchg_not_atomic_arg, 0), + UNIT_TEST(atomic_cmpxchg_32_threaded, test_atomic_arithmetic_threaded, &cmpxchg_32_arg, 0), + UNIT_TEST(atomic_cmpxchg_64_threaded, test_atomic_arithmetic_threaded, &cmpxchg_64_arg, 0), /* Level 1 tests */ UNIT_TEST(atomic_inc_and_test_not_atomic_threaded, test_atomic_arithmetic_and_test_threaded, &inc_and_test_not_atomic_arg, 1),