Message ID | 1594875225-5850-1-git-send-email-phil.yang@arm.com (mailing list archive) |
---|---|
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 71054A0540; Thu, 16 Jul 2020 06:58:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 964D11BEAA; Thu, 16 Jul 2020 06:58:02 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 77B761BEA5 for <dev@dpdk.org>; Thu, 16 Jul 2020 06:58:01 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CC7A531B; Wed, 15 Jul 2020 21:58:00 -0700 (PDT) Received: from phil-VirtualBox.shanghai.arm.com (phil-VirtualBox.shanghai.arm.com [10.169.109.137]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 297493F66B; Wed, 15 Jul 2020 21:57:56 -0700 (PDT) From: Phil Yang <phil.yang@arm.com> To: thomas@monjalon.net, john.mcnamara@intel.com, Honnappa.Nagarahalli@arm.com, drc@linux.vnet.ibm.com, dev@dpdk.org Cc: david.marchand@redhat.com, jerinj@marvell.com, konstantin.ananyev@intel.com, Ola.Liljedahl@arm.com, bruce.richardson@intel.com, Ruifeng.Wang@arm.com, nd@arm.com Date: Thu, 16 Jul 2020 12:53:41 +0800 Message-Id: <1594875225-5850-1-git-send-email-phil.yang@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1594621423-14796-1-git-send-email-phil.yang@arm.com> References: <1594621423-14796-1-git-send-email-phil.yang@arm.com> Subject: [dpdk-dev] [PATCH v8 0/3] generic rte atomic APIs deprecate proposal X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Series |
generic rte atomic APIs deprecate proposal
|
|
Message
Phil Yang
July 16, 2020, 4:53 a.m. UTC
DPDK provides generic rte_atomic APIs to do several atomic operations. These APIs are using the deprecated __sync built-ins and enforce full memory barriers on aarch64. However, full barriers are not necessary in many use cases. In order to address such use cases, C language offers C11 atomic APIs. The C11 atomic APIs provide finer memory barrier control by making use of the memory ordering parameter provided by the user. Various patches submitted in the past [2] and the patches in this series indicate significant performance gains on multiple aarch64 CPUs and no performance loss on x86. But the existing rte_atomic API implementations cannot be changed as the APIs do not take the memory ordering parameter. The only choice available is replacing the usage of the rte_atomic APIs with C11 atomic APIs. In order to make this change, the following steps are proposed: [1] deprecate rte_atomic APIs so that future patches do not use rte_atomic APIs (a script is added to flag the usages). [2] refactor the code that uses rte_atomic APIs to use c11 atomic APIs. This patchset contains: 1) changes to programmer guide describing writing efficient code for aarch64. 2) the checkpatch script changes to flag rte_atomicNN_xxx API usage in patches. 3) wraps up __atomic_thread_fence with explicit memory ordering parameter. v8: Make descriptions more general. (Honnappa) v7: 1. Remove code blocks in the guidance. 2. Remove code reference links in the guidance. 3. Remove the update of C11 atomics maintainers. v6: Add check for rte_smp barriers APIs in the new code. v5: 1. Wraps up __atomic_thread_fence to support optimized code for __ATOMIC_SEQ_CST memory order. 2. Flag __atomic_thread_fence with __ATOMIC_SEQ_CST in new patches. 3. Fix email address typo in patch 2/4. v4: 1. add reader-writer concurrency case describing. 2. claim maintainership of c11 atomics code for each platforms. 3. flag rte_atomicNN_xxx in new patches for modules that have been converted to c11 style. 4. flag __sync_xxx built-ins in new patches. 5. wraps up compiler atomic built-ins 6. move the changes of libraries which make use of c11 atomic APIs out of this patchset. v3: add libatomic dependency for 32-bit clang v2: 1. fix Clang '-Wincompatible-pointer-types' WARNING. 2. fix typos. Phil Yang (3): doc: add optimizations using C11 atomic built-ins devtools: prevent use of rte atomic APIs in future patches eal/atomic: add wrapper for C11 atomic thread fence devtools/checkpatches.sh | 40 ++++++++++++++++ doc/guides/prog_guide/writing_efficient_code.rst | 59 +++++++++++++++++++++++- lib/librte_eal/arm/include/rte_atomic_32.h | 6 +++ lib/librte_eal/arm/include/rte_atomic_64.h | 6 +++ lib/librte_eal/include/generic/rte_atomic.h | 6 +++ lib/librte_eal/ppc/include/rte_atomic.h | 6 +++ lib/librte_eal/x86/include/rte_atomic.h | 17 +++++++ 7 files changed, 139 insertions(+), 1 deletion(-)