From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: References: <20200806151938.198105-1-chris@chris-wilson.co.uk> From: Lionel Landwerlin Message-ID: Date: Thu, 6 Aug 2020 18:25:21 +0300 MIME-Version: 1.0 In-Reply-To: <20200806151938.198105-1-chris@chris-wilson.co.uk> Content-Language: en-US Subject: Re: [igt-dev] [PATCH i-g-t] syncobj_timeline: Tell the compiler to read from the thread List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: Chris Wilson , intel-gfx@lists.freedesktop.org Cc: igt-dev@lists.freedesktop.org List-ID: On 06/08/2020 18:19, Chris Wilson wrote: > 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 > Cc: Lionel Landwerlin Reviewed-by: Lionel Landwerlin > --- > tests/syncobj_timeline.c | 6 ++++-- > 1 file 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); _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev