summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2020-08-06 16:15:58 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2020-08-06 20:32:40 +0100
commit2faf5d2011c288535dac3ea47d02edd7de6a724d (patch)
tree6474cac07edd0d7f0c975dac2f3b6306347535f3
parentdb2413ccbf6c36bea4066e2a7254897779c22b89 (diff)
syncobj_timeline: Tell the compiler to read from the thread
32bits-limit waits for the thread to indicate it has started by busy spinning on a common variable. The compiler is clever and knows that the variable cannot change within the thread, and turns it into an infinite loop! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
-rw-r--r--tests/syncobj_timeline.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/syncobj_timeline.c b/tests/syncobj_timeline.c
index be7dd2d1c..20375cdd3 100644
--- a/tests/syncobj_timeline.c
+++ b/tests/syncobj_timeline.c
@@ -1245,9 +1245,11 @@ test_32bits_limit(int fd)
uint64_t value, last_value;
int i;
- igt_assert_eq(pthread_create(&thread, NULL, checker_thread_func, &thread_data), 0);
+ igt_assert_eq(pthread_create(&thread, NULL,
+ checker_thread_func, &thread_data), 0);
- while (!thread_data.started);
+ while (!READ_ONCE(thread_data.started))
+ ;
for (i = 0; i < ARRAY_SIZE(points); i++) {
int fence = sw_sync_timeline_create_fence(timeline, i + 1);