From patchwork Thu Mar 12 07:44:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Yang X-Patchwork-Id: 66562 Return-Path: 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 DD401A0569; Thu, 12 Mar 2020 08:45:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 390371BFA5; Thu, 12 Mar 2020 08:45:30 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 9B8E3FEB for ; Thu, 12 Mar 2020 08:45:28 +0100 (CET) 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 D67EF30E; Thu, 12 Mar 2020 00:45:27 -0700 (PDT) Received: from phil-VirtualBox.shanghai.arm.com (phil-VirtualBox.shanghai.arm.com [10.169.109.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3263C3F534; Thu, 12 Mar 2020 00:45:23 -0700 (PDT) From: Phil Yang To: thomas@monjalon.net, harry.van.haaren@intel.com, konstantin.ananyev@intel.com, stephen@networkplumber.org, maxime.coquelin@redhat.com, dev@dpdk.org Cc: david.marchand@redhat.com, jerinj@marvell.com, hemant.agrawal@nxp.com, Honnappa.Nagarahalli@arm.com, gavin.hu@arm.com, ruifeng.wang@arm.com, joyce.kong@arm.com, nd@arm.com Date: Thu, 12 Mar 2020 15:44:21 +0800 Message-Id: <1583999071-22872-1-git-send-email-phil.yang@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1583862551-2049-1-git-send-email-phil.yang@arm.com> References: <1583862551-2049-1-git-send-email-phil.yang@arm.com> Subject: [dpdk-dev] [PATCH v2 00/10] 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 [1] 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) the checkpatch script changes to flag rte_atomic API usage in patches. 2) changes to programmer guide describing writing efficient code for aarch64. 3) changes to various libraries to make use of c11 atomic APIs. We are planning to replicate this idea across all the other libraries, drivers, examples, test applications. In the next phase, we will add changes to the mbuf, the EAL interrupts and the event timer adapter libraries. v2: 1. fix Clang '-Wincompatible-pointer-types' WARNING. 2. fix typos. Honnappa Nagarahalli (2): service: avoid race condition for MT unsafe service service: identify service running on another core correctly Phil Yang (8): doc: add generic atomic deprecation section devtools: prevent use of rte atomic APIs in future patches vhost: optimize broadcast rarp sync with c11 atomic ipsec: optimize with c11 atomic for sa outbound sqn update service: remove rte prefix from static functions service: remove redundant code service: optimize with c11 one-way barrier service: relax barriers with C11 atomic operations devtools/checkpatches.sh | 9 ++ doc/guides/prog_guide/writing_efficient_code.rst | 60 +++++++- lib/librte_eal/common/rte_service.c | 175 ++++++++++++----------- lib/librte_ipsec/ipsec_sqn.h | 3 +- lib/librte_ipsec/sa.h | 2 +- lib/librte_vhost/vhost.h | 2 +- lib/librte_vhost/vhost_user.c | 7 +- lib/librte_vhost/virtio_net.c | 16 ++- 8 files changed, 175 insertions(+), 99 deletions(-)