From patchwork Mon Oct 16 23:08:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 132672 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 00FBE43183; Tue, 17 Oct 2023 01:10:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F239E41132; Tue, 17 Oct 2023 01:09:21 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 8520E40DDB for ; Tue, 17 Oct 2023 01:09:08 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 2827C20B74C7; Mon, 16 Oct 2023 16:09:06 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2827C20B74C7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1697497747; bh=m9YQ1Q9TL93P22eAcZiGDJfDrew+ECaERvMWKlPAJuY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E4s27mRuYyugmhZOS33Ln52IufmaxnpI7UyBeaYJZMhs5Fc3mr0BYg/oA4uGO1G0a UR8ODKj+gjUcA0Rf8h8r9pRVC5+IfKRM5TWstJZ0bVraTNL9Q0a9/J5zH1jOm9PusZ ceHSGao0SFZT1wrwiRlYVHJx/cZt9ixBysHuUHPA= 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 07/21] gpudev: use rte optional stdatomic API Date: Mon, 16 Oct 2023 16:08:51 -0700 Message-Id: <1697497745-20664-8-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1697497745-20664-1-git-send-email-roretzla@linux.microsoft.com> References: <1697497745-20664-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 {