From patchwork Thu Nov 7 21:35:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 62703 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 2C415A04AB; Thu, 7 Nov 2019 22:35:44 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2EF751BF90; Thu, 7 Nov 2019 22:35:43 +0100 (CET) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id EC5661BF40 for ; Thu, 7 Nov 2019 22:35:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573162541; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+YFLt6yXgD65uAdZfgs4Y010qkiyC5HHDJV314HwnrY=; b=OsZCEEWxR6TnHAn/ShWgKOTfzZGCKF2OSMzPtlwZgPLiZCZUi6wGii/yBFXiAlEmDJUbmm SKwrpbW40ILFRV3qKipPPdjzrd9/+MXimh3BeX50oV4qC3VhPXs/bCWb4rk2dFDF2gEcg0 pbT2L14gJvJFgGvjnJN3gsFYiYKq3TA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-369-hDguF_xON9-HRKJpi_73tQ-1; Thu, 07 Nov 2019 16:35:37 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 665A71800DFB; Thu, 7 Nov 2019 21:35:36 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-222.brq.redhat.com [10.40.204.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3DF6E608B2; Thu, 7 Nov 2019 21:35:34 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: nd@arm.com, konstantin.ananyev@intel.com Date: Thu, 7 Nov 2019 22:35:23 +0100 Message-Id: <1573162528-16230-1-git-send-email-david.marchand@redhat.com> In-Reply-To: <1561911676-37718-1-git-send-email-gavin.hu@arm.com> References: <1561911676-37718-1-git-send-email-gavin.hu@arm.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: hDguF_xON9-HRKJpi_73tQ-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH v13 0/5] use WFE for aarch64 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 has multiple use cases where the core repeatedly polls a location in memory. This polling results in many cache and memory transactions. Arm architecture provides WFE (Wait For Event) instruction, which allows the cpu core to enter a low power state until woken up by the update to the memory location being polled. Thus reducing the cache and memory transactions. x86 has the PAUSE hint instruction to reduce such overhead. The rte_wait_until_equal_xxx APIs abstract the functionality of 'polling for a memory location to become equal to a given value'. For non-Arm platforms, these APIs are just wrappers around do-while loop with rte_pause, so there are no performance differences. For Arm platforms, use of WFE can be configured using CONFIG_RTE_USE_WFE option. It is disabled by default. Currently, use of WFE is supported only for aarch64 platforms. armv7 platforms do support the WFE instruction, but they require explicit wake up events(sev) and are less performannt. Testing shows that, performance varies across different platforms, with some showing degradation. CONFIG_RTE_USE_WFE should be enabled depending on the performance on the target platforms. V13: - added release notes update, - reworked arm implementation to avoid exporting inlines, - added assert in generic implementation, V12: - remove the 'rte_' prefix from the arm specific functions (David Marchand) - use the __atomic_load_ex_xx functions in arm specific implementations of APIS (David Marchand) - remove the experimental warnings (David Marchand) - tweak the macros working scope (David Marchand) V11: - add rte_ prefix to the __atomic_load_ex_x funtions (Ananyev Konstantin) - define the above rte_atomic_load_ex_x funtions even if not RTE_WAIT_UNTIL_EQUAL_ARCH_DEFINED for future non-wfe usages (Ananyev Konstantin) - use the above functions for arm specific rte_wait_until_equal_x functions (Ananyev Konstantin) - simplify the generic implementation by immersing "if" into "while" (Ananyev Konstantin) V10: - move arm specific stuff to arch/arm/rte_pause_64.h (Ananyev Konstantin) V9: - fix a weblink broken (David Marchand) - define rte_wfe and rte_sev() (Ananyev Konstantin) - explicitly define three function APIs instead of marcos (Ananyev Konstantin) - incorporate common rte_wfe and rte_sev into the generic rte_spinlock (David Marchand) - define arch neutral RTE_WAIT_UNTIL_EQUAL_ARCH_DEFINED (Ananyev Konstantin) - define rte_load_ex_16/32/64 functions to use load-exclusive instruction for aarch64, which is required for wake up of WFE - drop the rte_spinlock patch from this series, as the it calls this experimental API and it is widely included by a lot of components each requires the ALLOW_EXPERIMENRAL_API for the Makefile and meson.build, leave it to future after the experimental is removed. V8: - simplify dmb definition to use io barriers (David Marchand) - define wfe() and sev() macros and use them inside normal C code (Ananyev Konstantin) - pass memorder as parameter, not to incorporate it into function name, less functions, similar to C11 atomic intrinsics (Ananyev Konstantin) - remove mandating RTE_FORCE_INTRINSICS in arm spinlock implementation (David Marchand) - undef __WAIT_UNTIL_EQUAL after use (David Marchand) - add experimental tag and warning (David Marchand) - add the limitation of using WFE instruction in the commit log (David Marchand) - tweak the use of RTE_FORCE_INSTRINSICS (still mandatory for aarch64) and RTE_ARM_USE_WFE for spinlock (David Marchand) - drop the rte_ring patch from this series, as the rte_ring.h calls this API and it is widely included by a lot of components each requires the ALLOW_EXPERIMENRAL_API for the Makefile and meson.build, leave it to future after the experimental is removed. V7: - fix the checkpatch LONG_LINE_COMMENT issue V6: - squash the RTE_ARM_USE_WFE configuration entry patch into the new API patch - move the new configuration to the end of EAL - add doxygen comments to reflect the relaxed and acquire semantics - correct the meson configuration V5: - add doxygen comments for the new APIs - spinlock early exit without wfe if the spinlock not taken by others. - add two patches on top for opdl and thunderx V4: - rename the config as CONFIG_RTE_ARM_USE_WFE to indicate it applys to arm only - introduce a macro for assembly Skelton to reduce the duplication of code - add one patch for nxp fslmc to address a compiling error V3: - Convert RFCs to patches V2: - Use inline functions instead of marcos - Add load and compare in the beginning of the APIs - Fix some style errors in asm inline V1: - Add the new APIs and use it for ring and locks Gavin Hu (5): bus/fslmc: fix the conflicting dmb function eal: add the APIs to wait until equal ticketlock: use new API to reduce contention on aarch64 net/thunderx: use new API to save cycles on aarch64 event/opdl: use new API to save cycles on aarch64 config/arm/meson.build | 1 + config/common_base | 5 + doc/guides/rel_notes/release_19_11.rst | 5 + drivers/bus/fslmc/mc/fsl_mc_sys.h | 9 +- drivers/event/opdl/Makefile | 1 + drivers/event/opdl/meson.build | 1 + drivers/event/opdl/opdl_ring.c | 5 +- drivers/net/thunderx/Makefile | 1 + drivers/net/thunderx/meson.build | 1 + drivers/net/thunderx/nicvf_rxtx.c | 3 +- .../common/include/arch/arm/rte_pause_64.h | 133 +++++++++++++++++++++ lib/librte_eal/common/include/generic/rte_pause.h | 105 ++++++++++++++++ .../common/include/generic/rte_ticketlock.h | 3 +- 13 files changed, 261 insertions(+), 12 deletions(-)