From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7B9E643190; Tue, 17 Oct 2023 22:32:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6301F42E2F; Tue, 17 Oct 2023 22:31:33 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 008B7402DD for ; Tue, 17 Oct 2023 22:31:20 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id AE03820B74C5; Tue, 17 Oct 2023 13:31:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com AE03820B74C5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1697574678; bh=m9YQ1Q9TL93P22eAcZiGDJfDrew+ECaERvMWKlPAJuY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qc31ITdNYLrw1gaOOhy7Z65tvC6i3MeZgLCCCuWwutLhxDVX3YOtUeAhGbMRMCI0n 5mC2rtRFdWUABmuFKLw2LJHKKjCSKFi0VsSGXhya7zkbSKiVpzYnM0y1oPz2fbiye+ wFwXVewg26JfPn/PWwVBZ8l34znQn7/lem8EX5d0= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Anatoly Burakov , Andrew Rybchenko , Bruce Richardson , Chenbo Xia , Ciara Power , David Christensen , David Hunt , Dmitry Kozlyuk , Dmitry Malloy , Elena Agostini , Erik Gabriel Carrillo , Fan Zhang , Ferruh Yigit , Harman Kalra , Harry van Haaren , Honnappa Nagarahalli , Jerin Jacob , Konstantin Ananyev , Matan Azrad , Maxime Coquelin , Narcisa Ana Maria Vasile , Nicolas Chautru , Olivier Matz , Ori Kam , Pallavi Kadam , Pavan Nikhilesh , Reshma Pattan , Sameh Gobriel , Shijith Thotton , Sivaprasad Tummala , Stephen Hemminger , Suanming Mou , Sunil Kumar Kori , Thomas Monjalon , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Tyler Retzlaff Subject: [PATCH v2 05/19] gpudev: use rte optional stdatomic API Date: Tue, 17 Oct 2023 13:31:03 -0700 Message-Id: <1697574677-16578-6-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1697574677-16578-1-git-send-email-roretzla@linux.microsoft.com> References: <1697497745-20664-1-git-send-email-roretzla@linux.microsoft.com> <1697574677-16578-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Replace the use of gcc builtin __atomic_xxx intrinsics with corresponding rte_atomic_xxx optional stdatomic API Signed-off-by: Tyler Retzlaff --- lib/gpudev/gpudev.c | 6 +++--- lib/gpudev/gpudev_driver.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/gpudev/gpudev.c b/lib/gpudev/gpudev.c index 8f12abe..6845d18 100644 --- a/lib/gpudev/gpudev.c +++ b/lib/gpudev/gpudev.c @@ -228,7 +228,7 @@ struct rte_gpu * dev->mpshared->info.numa_node = -1; dev->mpshared->info.parent = RTE_GPU_ID_NONE; TAILQ_INIT(&dev->callbacks); - __atomic_fetch_add(&dev->mpshared->process_refcnt, 1, __ATOMIC_RELAXED); + rte_atomic_fetch_add_explicit(&dev->mpshared->process_refcnt, 1, rte_memory_order_relaxed); gpu_count++; GPU_LOG(DEBUG, "new device %s (id %d) of total %d", @@ -277,7 +277,7 @@ struct rte_gpu * TAILQ_INIT(&dev->callbacks); dev->mpshared = shared_dev; - __atomic_fetch_add(&dev->mpshared->process_refcnt, 1, __ATOMIC_RELAXED); + rte_atomic_fetch_add_explicit(&dev->mpshared->process_refcnt, 1, rte_memory_order_relaxed); gpu_count++; GPU_LOG(DEBUG, "attached device %s (id %d) of total %d", @@ -340,7 +340,7 @@ struct rte_gpu * gpu_free_callbacks(dev); dev->process_state = RTE_GPU_STATE_UNUSED; - __atomic_fetch_sub(&dev->mpshared->process_refcnt, 1, __ATOMIC_RELAXED); + rte_atomic_fetch_sub_explicit(&dev->mpshared->process_refcnt, 1, rte_memory_order_relaxed); gpu_count--; return 0; diff --git a/lib/gpudev/gpudev_driver.h b/lib/gpudev/gpudev_driver.h index 42898c7..0b1e7f2 100644 --- a/lib/gpudev/gpudev_driver.h +++ b/lib/gpudev/gpudev_driver.h @@ -69,7 +69,7 @@ struct rte_gpu_mpshared { /* Device info structure. */ struct rte_gpu_info info; /* Counter of processes using the device. */ - uint16_t process_refcnt; /* Updated by this library. */ + RTE_ATOMIC(uint16_t) process_refcnt; /* Updated by this library. */ }; struct rte_gpu { -- 1.8.3.1