mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 18:16:01 +03:00
Add threaded tests for inc_and_test, dec_and_test, and sub_and_test operations to verify atomicity. Also, add non-atomic tests for these to verify we are actually verifying that the operations are atomic. The new tests initialize an atomic to a non-zero value such that the threads executing the atomic operation will reach and pass zero. The test verifies only 1 thread observed zero (the atomic operation returned true). The test is executed 5000 times with 100 threads. For example, the inc_and_test will start the atomic at -50 and 100 threads will concurrently increment the atomic. The test will verify only one of the 100 threads observed 0. These tests are L1 tests since we don't expect regressions in the atomics (they are basically reusing the GCC builtins) and have longer run times in order to make sure the non-atomic variants fail. JIRA NVGPU-2251 Change-Id: I7811779bc7c0965b4465d420066f3cff87bfa13e Signed-off-by: Philip Elcan <pelcan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2079378 GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>