From patchwork Tue Jun 18 12:27:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Tucker X-Patchwork-Id: 11001547 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A9A816C5 for ; Tue, 18 Jun 2019 12:28:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BB6428A45 for ; Tue, 18 Jun 2019 12:28:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9072828A69; Tue, 18 Jun 2019 12:28:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5679928A45 for ; Tue, 18 Jun 2019 12:28:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EEEE76E157; Tue, 18 Jun 2019 12:28:31 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id AA5146E157; Tue, 18 Jun 2019 12:28:30 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: gtucker) with ESMTPSA id 203EB2861E9 From: Guillaume Tucker To: Arkadiusz Hiler , Petri Latvala , "Ser, Simon" Date: Tue, 18 Jun 2019 13:27:43 +0100 Message-Id: <20190618122746.61310-2-guillaume.tucker@collabora.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190618122746.61310-1-guillaume.tucker@collabora.com> References: <20190618122746.61310-1-guillaume.tucker@collabora.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v3 1/4] meson: add libatomic dependency X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Add conditional dependency on libatomic in order to be able to use the __atomic_* functions instead of the older __sync_* ones. The libatomic library is only needed when there aren't any native support on the current architecture, so a linker test is used for this purpose. This enables atomic operations to be on a wider number of architectures including MIPS. Signed-off-by: Guillaume Tucker Reviewed-by: Simon Ser --- Notes: v2: add linker test for libatomic v3: use null_dep meson.build | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/meson.build b/meson.build index 6268c58d3634..118ad667ffb5 100644 --- a/meson.build +++ b/meson.build @@ -180,6 +180,20 @@ realtime = cc.find_library('rt') dlsym = cc.find_library('dl') zlib = cc.find_library('z') +if cc.links(''' +#include +int main(void) { + uint32_t x32 = 0; + uint64_t x64 = 0; + __atomic_load_n(&x32, __ATOMIC_SEQ_CST); + __atomic_load_n(&x64, __ATOMIC_SEQ_CST); + return 0; +}''', name : 'built-in atomics') + libatomic = null_dep +else + libatomic = cc.find_library('atomic') +endif + if cc.has_header('linux/kd.h') config.set('HAVE_LINUX_KD_H', 1) endif From patchwork Tue Jun 18 12:27:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Tucker X-Patchwork-Id: 11001549 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 34C586C5 for ; Tue, 18 Jun 2019 12:28:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2469128A45 for ; Tue, 18 Jun 2019 12:28:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18F2128A62; Tue, 18 Jun 2019 12:28:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C746328A45 for ; Tue, 18 Jun 2019 12:28:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 417096E15E; Tue, 18 Jun 2019 12:28:32 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id B02586E15A; Tue, 18 Jun 2019 12:28:30 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: gtucker) with ESMTPSA id 564482861EA From: Guillaume Tucker To: Arkadiusz Hiler , Petri Latvala , "Ser, Simon" Date: Tue, 18 Jun 2019 13:27:44 +0100 Message-Id: <20190618122746.61310-3-guillaume.tucker@collabora.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190618122746.61310-1-guillaume.tucker@collabora.com> References: <20190618122746.61310-1-guillaume.tucker@collabora.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v3 2/4] gitlab-ci: add libatomic to docker images X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Add libatomic to the Fedora docker image so it can link binaries that use __atomic_* functions. Also explicitly add libatomic1 to Debian docker images as it is needed in particular on non-x86 architectures for run-time linkage. Signed-off-by: Guillaume Tucker --- Notes: v2: add libatomic1 in Debian docker images v3: add libatomic1 for non-x86 arches in Debian docker images Dockerfile.debian | 1 + Dockerfile.debian-arm64 | 1 + Dockerfile.debian-armhf | 1 + Dockerfile.fedora | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile.debian b/Dockerfile.debian index b9c3be3945e0..d23591850c4e 100644 --- a/Dockerfile.debian +++ b/Dockerfile.debian @@ -6,6 +6,7 @@ RUN apt-get install -y \ flex \ bison \ pkg-config \ + libatomic1 \ libpciaccess-dev \ libkmod-dev \ libprocps-dev \ diff --git a/Dockerfile.debian-arm64 b/Dockerfile.debian-arm64 index 7b3a3c7ca803..c9fb28c804b8 100644 --- a/Dockerfile.debian-arm64 +++ b/Dockerfile.debian-arm64 @@ -14,6 +14,7 @@ RUN dpkg --add-architecture arm64 RUN apt-get update RUN apt-get install -y \ gcc-aarch64-linux-gnu \ + libatomic1:arm64 \ libpciaccess-dev:arm64 \ libkmod-dev:arm64 \ libprocps-dev:arm64 \ diff --git a/Dockerfile.debian-armhf b/Dockerfile.debian-armhf index c67a1e2acf6a..3a133d849d68 100644 --- a/Dockerfile.debian-armhf +++ b/Dockerfile.debian-armhf @@ -14,6 +14,7 @@ RUN dpkg --add-architecture armhf RUN apt-get update RUN apt-get install -y \ gcc-arm-linux-gnueabihf \ + libatomic1:armhf \ libpciaccess-dev:armhf \ libkmod-dev:armhf \ libprocps-dev:armhf \ diff --git a/Dockerfile.fedora b/Dockerfile.fedora index 6686e587613d..c84b412b0723 100644 --- a/Dockerfile.fedora +++ b/Dockerfile.fedora @@ -1,7 +1,7 @@ FROM fedora:30 RUN dnf install -y \ - gcc flex bison meson ninja-build xdotool \ + gcc flex bison libatomic meson ninja-build xdotool \ 'pkgconfig(libdrm)' \ 'pkgconfig(pciaccess)' \ 'pkgconfig(libkmod)' \ From patchwork Tue Jun 18 12:27:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Tucker X-Patchwork-Id: 11001553 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F3B16C5 for ; Tue, 18 Jun 2019 12:28:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 299A628A45 for ; Tue, 18 Jun 2019 12:28:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E00D28A62; Tue, 18 Jun 2019 12:28:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BC14F28A45 for ; Tue, 18 Jun 2019 12:28:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3692D6E169; Tue, 18 Jun 2019 12:28:33 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id EC8536E157; Tue, 18 Jun 2019 12:28:30 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: gtucker) with ESMTPSA id 9341F2861EB From: Guillaume Tucker To: Arkadiusz Hiler , Petri Latvala , "Ser, Simon" Date: Tue, 18 Jun 2019 13:27:45 +0100 Message-Id: <20190618122746.61310-4-guillaume.tucker@collabora.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190618122746.61310-1-guillaume.tucker@collabora.com> References: <20190618122746.61310-1-guillaume.tucker@collabora.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v3 3/4] i915/gem_create: use atomic_* instead of __sync_* X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP This fixes builds on some architectures, in particular MIPS which doesn't have __sync_add_and_fetch_8 and __sync_val_compare_and_swap_8 for 64-bit variable handling. * replace calls to the older __sync_* functions with the new atomic_* standard ones * use the _Atomic type modifier as required with stdatomic.h functions * add dependency for gem_create on libatomic Signed-off-by: Guillaume Tucker Reviewed-by: Simon Ser --- Notes: v2: use atomic_* and only link libatomic with gem_create tests/Makefile.am | 2 +- tests/i915/gem_create.c | 16 ++++++++++++---- tests/meson.build | 9 ++++++++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 5a428b8ac213..bbd386c9c2db 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -90,7 +90,7 @@ AM_LDFLAGS = -Wl,--as-needed drm_import_export_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS) drm_import_export_LDADD = $(LDADD) -lpthread gem_create_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS) -gem_create_LDADD = $(LDADD) -lpthread +gem_create_LDADD = $(LDADD) -lpthread -latomic gem_close_race_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS) gem_close_race_LDADD = $(LDADD) -lpthread gem_ctx_thrash_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS) diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c index 43cbf45f289b..9008cd8a21e3 100644 --- a/tests/i915/gem_create.c +++ b/tests/i915/gem_create.c @@ -45,6 +45,7 @@ #include #include #include +#include #include @@ -156,7 +157,14 @@ static void invalid_nonaligned_size(int fd) gem_close(fd, create.handle); } -static uint64_t get_npages(uint64_t *global, uint64_t npages) +static uint64_t atomic_compare_swap_u64(_Atomic(uint64_t) *ptr, + uint64_t oldval, uint64_t newval) +{ + atomic_compare_exchange_strong(ptr, &oldval, newval); + return oldval; +} + +static uint64_t get_npages(_Atomic(uint64_t) *global, uint64_t npages) { uint64_t try, old, max; @@ -165,13 +173,13 @@ static uint64_t get_npages(uint64_t *global, uint64_t npages) old = max; try = 1 + npages % (max / 2); max -= try; - } while ((max = __sync_val_compare_and_swap(global, old, max)) != old); + } while ((max = atomic_compare_swap_u64(global, old, max)) != old); return try; } struct thread_clear { - uint64_t max; + _Atomic(uint64_t) max; int timeout; int i915; }; @@ -202,7 +210,7 @@ static void *thread_clear(void *data) } gem_close(i915, create.handle); - __sync_add_and_fetch(&arg->max, npages); + atomic_fetch_add(&arg->max, npages); } return NULL; diff --git a/tests/meson.build b/tests/meson.build index f168fbbae2a8..ffd432d38193 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -110,7 +110,6 @@ i915_progs = [ 'gem_close_race', 'gem_concurrent_blit', 'gem_cpu_reloc', - 'gem_create', 'gem_cs_prefetch', 'gem_cs_tlb', 'gem_ctx_bad_destroy', @@ -277,6 +276,14 @@ foreach prog : i915_progs test_list += prog endforeach +test_executables += executable('gem_create', + join_paths('i915', 'gem_create.c'), + dependencies : test_deps + [ libatomic ], + install_dir : libexecdir, + install_rpath : libexecdir_rpathdir, + install : true) +test_list += 'gem_create' + test_executables += executable('gem_ctx_sseu', join_paths('i915', 'gem_ctx_sseu.c'), dependencies : test_deps + [ lib_igt_perf ], From patchwork Tue Jun 18 12:27:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Tucker X-Patchwork-Id: 11001545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8357F76 for ; Tue, 18 Jun 2019 12:28:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72C4A28A45 for ; Tue, 18 Jun 2019 12:28:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6758428A62; Tue, 18 Jun 2019 12:28:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E6E3328A45 for ; Tue, 18 Jun 2019 12:28:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B75F16E15A; Tue, 18 Jun 2019 12:28:31 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1E5E46E15A; Tue, 18 Jun 2019 12:28:31 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: gtucker) with ESMTPSA id C9CBA2861EC From: Guillaume Tucker To: Arkadiusz Hiler , Petri Latvala , "Ser, Simon" Date: Tue, 18 Jun 2019 13:27:46 +0100 Message-Id: <20190618122746.61310-5-guillaume.tucker@collabora.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190618122746.61310-1-guillaume.tucker@collabora.com> References: <20190618122746.61310-1-guillaume.tucker@collabora.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v3 4/4] tests/sw_sync: use atomic_* instead of __sync_* X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Replace calls to the older __sync_* functions with the new atomic_* standard ones to be consistent with other tests and improve portability across CPU architectures. Add dependency of sw_sync on libatomic. Signed-off-by: Guillaume Tucker Reviewed-by: Simon Ser --- Notes: v2: use atomic_* and only link libatomic with sw_sync tests/Makefile.am | 1 + tests/meson.build | 8 +++++++- tests/sw_sync.c | 12 ++++++------ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index bbd386c9c2db..7d71df8c7a2e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -122,6 +122,7 @@ prime_self_import_LDADD = $(LDADD) -lpthread gem_userptr_blits_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS) gem_userptr_blits_LDADD = $(LDADD) -lpthread perf_pmu_LDADD = $(LDADD) $(top_builddir)/lib/libigt_perf.la +sw_sync_LDADD = $(LDADD) -latomic kms_flip_LDADD = $(LDADD) -lpthread diff --git a/tests/meson.build b/tests/meson.build index ffd432d38193..34a74025a537 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -76,7 +76,6 @@ test_progs = [ 'prime_self_import', 'prime_udl', 'prime_vgem', - 'sw_sync', 'syncobj_basic', 'syncobj_wait', 'template', @@ -329,6 +328,13 @@ executable('testdisplay', ['testdisplay.c', 'testdisplay_hotplug.c'], install : true) test_list += 'testdisplay' +test_executables += executable('sw_sync', 'sw_sync.c', + dependencies : test_deps + [ libatomic ], + install_dir : libexecdir, + install_rpath : libexecdir_rpathdir, + install : true) +test_list += 'sw_sync' + subdir('amdgpu') gen_testlist = find_program('generate_testlist.sh') diff --git a/tests/sw_sync.c b/tests/sw_sync.c index 950b8b614759..62d1d17cab45 100644 --- a/tests/sw_sync.c +++ b/tests/sw_sync.c @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -43,7 +44,7 @@ IGT_TEST_DESCRIPTION("Test SW Sync Framework"); typedef struct { int timeline; uint32_t thread_id; - uint32_t *counter; + _Atomic(uint32_t) *counter; sem_t *sem; } data_t; @@ -489,7 +490,7 @@ static void test_sync_multi_consumer(void) pthread_t thread_arr[MULTI_CONSUMER_THREADS]; sem_t sem; int timeline; - uint32_t counter = 0; + _Atomic(uint32_t) counter = 0; uintptr_t thread_ret = 0; data_t data; int i, ret; @@ -517,7 +518,7 @@ static void test_sync_multi_consumer(void) { sem_wait(&sem); - __sync_fetch_and_add(&counter, 1); + atomic_fetch_add(&counter, 1); sw_sync_timeline_inc(timeline, 1); } @@ -554,7 +555,7 @@ static void * test_sync_multi_consumer_producer_thread(void *arg) if (sync_fence_wait(fence, 1000) < 0) return (void *) 1; - if (__sync_fetch_and_add(data->counter, 1) != next_point) + if (atomic_fetch_add(data->counter, 1) != next_point) return (void *) 1; /* Kick off the next thread. */ @@ -570,7 +571,7 @@ static void test_sync_multi_consumer_producer(void) data_t data_arr[MULTI_CONSUMER_PRODUCER_THREADS]; pthread_t thread_arr[MULTI_CONSUMER_PRODUCER_THREADS]; int timeline; - uint32_t counter = 0; + _Atomic(uint32_t) counter = 0; uintptr_t thread_ret = 0; data_t data; int i, ret; @@ -900,4 +901,3 @@ igt_main igt_subtest("sync_random_merge") test_sync_random_merge(); } -