From patchwork Mon Oct 21 00:22:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 177006 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2676652ill; Sun, 20 Oct 2019 17:23:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoQAFRPLLfQYR0ZUBNtYWDO/j9M/iyExKmpnsNWx9kat93+OZaaz1F7Ku5zoUpYSCRd8Bh X-Received: by 2002:a17:906:9391:: with SMTP id l17mr5565423ejx.315.1571617421518; Sun, 20 Oct 2019 17:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571617421; cv=none; d=google.com; s=arc-20160816; b=N6PLLXs3m6hmJ0MXkG6VseLFS0pNGhoje1FFDb6n3qqWQY8B/Vnie4L1KD2GXKIFXF dFvQqUNIAxfNvgaeUl84nfXgXLL/8Kestt0XfjMolngrnSgg+IIyHvSu64wWzTWJNxdi cjRGbVQGzHK1uzNTzz2IrjBUXm+GLZ/RY0cxbhWeCiCnjfw5ggrv/gWFWbHdqcQt0rD1 HoFYCJyzzwDdvCoGi27n4Wot1aJlvGG3rGaH08srcLIhH0IHDX+kbqaGBhWsNbghZeW1 Te9IZsr5SDLos4JZ/cnoOQPr5X/Cg+PgcGgEDHaFQwGsDJ6M/Rc0TcIkN8xQGx/SaduB Lh8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=jyl5aFLUwjS18ICL0mrrscZ80T5Ucm3NYcND+BI88GE=; b=npYEw32Jm5gf/zKNWBSVGYhaEvZRhZWvyIiZA44/5KrXeP/HzjY8TnCZiogD+TfPqX Dy5j+Pux7HLemA6Mv2mkwaM7hf0JJaj5/OsfKIJ7I2bBPHxSvso+qv3TK/n+7FLZ+4mO EtOlrp9tEiy8TrMl+9L5zs6WFYW58I8tudsB++nvOO9h+1caLIgtYsNEbKH+SjwAQUdD FOk5JHyd9HlvGQnGWM6ipe+NDmz6dfMF7pgEdhvfXn2rM5uCkJfCSbvCSs5NyUIMnuBr oleUQE1KbAoPxPGeK8ibdi/ZPOLOQ/3mEES6xAj0TFiLqe6/cWmD80Q/QhQmtjBD90xP +fNw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id h4si9209146edd.189.2019.10.20.17.23.40; Sun, 20 Oct 2019 17:23:41 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BFC68F11; Mon, 21 Oct 2019 02:23:39 +0200 (CEST) Received: from foss.arm.com (unknown [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 98FB1DE3 for ; Mon, 21 Oct 2019 02:23:37 +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 B092F36D; Sun, 20 Oct 2019 17:23:27 -0700 (PDT) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.12.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A256C3F71F; Sun, 20 Oct 2019 17:23:27 -0700 (PDT) From: Honnappa Nagarahalli To: olivier.matz@6wind.com, sthemmin@microsoft.com, jerinj@marvell.com, bruce.richardson@intel.com, david.marchand@redhat.com, pbhagavatula@marvell.com, konstantin.ananyev@intel.com, drc@linux.vnet.ibm.com, hemant.agrawal@nxp.com, honnappa.nagarahalli@arm.com Cc: dev@dpdk.org, dharmik.thakkar@arm.com, ruifeng.wang@arm.com, gavin.hu@arm.com Date: Sun, 20 Oct 2019 19:22:54 -0500 Message-Id: <20191021002300.26497-1-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190906190510.11146-1-honnappa.nagarahalli@arm.com> References: <20190906190510.11146-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [RFC v6 0/6] lib/ring: APIs to support custom element size 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" The current rte_ring hard-codes the type of the ring element to 'void *', hence the size of the element is hard-coded to 32b/64b. Since the ring element type is not an input to rte_ring APIs, it results in couple of issues: 1) If an application requires to store an element which is not 64b, it needs to write its own ring APIs similar to rte_event_ring APIs. This creates additional burden on the programmers, who end up making work-arounds and often waste memory. 2) If there are multiple libraries that store elements of the same type, currently they would have to write their own rte_ring APIs. This results in code duplication. This patch adds new APIs to support configurable ring element size. The APIs support custom element sizes by allowing to define the ring element to be a multiple of 32b. The aim is to achieve same performance as the existing ring implementation. The patch adds same performance tests that are run for existing APIs. This allows for performance comparison. I also tested with memcpy. x86 shows significant improvements on bulk and burst tests. On the Arm platform, I used, there is a drop of 4% to 6% in few tests. May be this is something that we can explore later. Note that this version skips changes to other libraries as I would like to get an agreement on the implementation from the community. They will be added once there is agreement on the rte_ring changes. v6 - Labelled as RFC to indicate the better status - Added unit tests to test the rte_ring_xxx_elem APIs - Corrected 'macro based partial memcpy' (5/6) patch - Added Konstantin's method after correction (6/6) - Check Patch shows significant warnings and errors mainly due copying code from existing test cases. None of them are harmful. I will fix them once we have an agreement. v5 - Use memcpy for chunks of 32B (Konstantin). - Both 'ring_perf_autotest' and 'ring_perf_elem_autotest' are available to compare the results easily. - Copying without memcpy is also available in 1/3, if anyone wants to experiment on their platform. - Added other platform owners to test on their respective platforms. v4 - Few fixes after more performance testing v3 - Removed macro-fest and used inline functions (Stephen, Bruce) v2 - Change Event Ring implementation to use ring templates (Jerin, Pavan) Honnappa Nagarahalli (6): test/ring: use division for cycle count calculation lib/ring: apis to support configurable element size test/ring: add functional tests for configurable element size ring test/ring: add perf tests for configurable element size ring lib/ring: copy ring elements using memcpy partially lib/ring: improved copy function to copy ring elements app/test/Makefile | 2 + app/test/meson.build | 2 + app/test/test_ring_elem.c | 859 +++++++++++++++++++++++++++ app/test/test_ring_perf.c | 22 +- app/test/test_ring_perf_elem.c | 419 +++++++++++++ lib/librte_ring/Makefile | 3 +- lib/librte_ring/meson.build | 4 + lib/librte_ring/rte_ring.c | 34 +- lib/librte_ring/rte_ring.h | 1 + lib/librte_ring/rte_ring_elem.h | 818 +++++++++++++++++++++++++ lib/librte_ring/rte_ring_version.map | 2 + 11 files changed, 2147 insertions(+), 19 deletions(-) create mode 100644 app/test/test_ring_elem.c create mode 100644 app/test/test_ring_perf_elem.c create mode 100644 lib/librte_ring/rte_ring_elem.h -- 2.17.1