From patchwork Mon Jun 3 11:54:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Tucker X-Patchwork-Id: 10972801 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 5F1FC14C0 for ; Mon, 3 Jun 2019 11:55:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5081028414 for ; Mon, 3 Jun 2019 11:55:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44C47288AE; Mon, 3 Jun 2019 11:55:09 +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 C81C22874F for ; Mon, 3 Jun 2019 11:55:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2DD5C89268; Mon, 3 Jun 2019 11:55:08 +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 D0CC18925F; Mon, 3 Jun 2019 11:55:06 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: gtucker) with ESMTPSA id 1B9A128A4FF From: Guillaume Tucker To: Arkadiusz Hiler , Petri Latvala Date: Mon, 3 Jun 2019 12:54:50 +0100 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: <73773a5061681c502db373df698d2d24b4ad267a.1559562608.git.guillaume.tucker@collabora.com> References: <73773a5061681c502db373df698d2d24b4ad267a.1559562608.git.guillaume.tucker@collabora.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 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. Signed-off-by: Guillaume Tucker --- tests/Makefile.am | 1 + tests/sw_sync.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 18a0f1f20592..71514d4d2e5a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -121,6 +121,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/sw_sync.c b/tests/sw_sync.c index 950b8b614759..2ee1e1c60b32 100644 --- a/tests/sw_sync.c +++ b/tests/sw_sync.c @@ -517,7 +517,7 @@ static void test_sync_multi_consumer(void) { sem_wait(&sem); - __sync_fetch_and_add(&counter, 1); + __atomic_fetch_add(&counter, 1, __ATOMIC_SEQ_CST); sw_sync_timeline_inc(timeline, 1); } @@ -554,7 +554,8 @@ 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, __ATOMIC_SEQ_CST) != + next_point) return (void *) 1; /* Kick off the next thread. */ @@ -900,4 +901,3 @@ igt_main igt_subtest("sync_random_merge") test_sync_random_merge(); } -