From patchwork Fri Dec 20 04:45:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 182198 Delivered-To: patch@linaro.org Received: by 2002:a92:1f98:0:0:0:0:0 with SMTP id f24csp57294ilf; Thu, 19 Dec 2019 20:45:53 -0800 (PST) X-Google-Smtp-Source: APXvYqyN8Pu9im/B8YndpZQ/w04ryO25ehAuCXXwl/G+cyS2KOkf6DiEQNPs4qFYLwnQoSClRa6f X-Received: by 2002:a1c:6404:: with SMTP id y4mr13936909wmb.143.1576817153630; Thu, 19 Dec 2019 20:45:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576817153; cv=none; d=google.com; s=arc-20160816; b=w6MmUK3/iLtQSZoQ8aepstVKt/FrvHqrHj9OU1DwGkVh4WHshw2cBcIEX3P7xVn+im SSIZugLk14SjxLVaAbuXUWMHjdZCNvGE0btyoPpvcA5HlRyYcpL+YVmZNavxtNFOEosC pgwvOKrYKyrxY2FjYXDViXiCPNLawXN0xr/HjZ6cM0QnK1/dsaTppfNdJqzDDLEXSbdf /9jCpsWUS/d1kTo1PbA9jdfXxWjHn+x08QxJlJvzmBI4IFODwsiAR98cMByI8kOTS49B KVOm2oFxzhmlFKx7BGmny4t79a4k3Ufez8ZrZV+BtBi2GA9TZ5gzrufa95oKpkJAQeaW EZAA== 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=DWwfhnD7EJYcu2MMpNP9d4W3iIq/a5GsBPQ2ebrx/7c=; b=NBjlpRUoq6s8TOUxKKZd+FGJM2LqS/IdVbsKx0w8IN+IM1gfkbLlwFISueHWSqk2IG lxgMxL9iWy2KlvXOR4x0IGnq5klT+EtnsfnxYyEuPQ2u3WIMbUQGiVclFcfXpeZUwSL1 cSeJ0+UdVgwuar2jql5J1gogJ4faoG45QmDScVJbD+A9QNy9QxNw/g4ETbuEcptQm23V +yOIU6hhEfKfGHI17k6Rf8jTig6Hmygnv9SSDTXg1eeymAanumir8A4r4y5inF77Ld1Z nAhdlkGnLM/EgTyNO2nxKpr8ZHCDqQZ9MLkzbU3Kv1x86mcGwikuxiE6t9Vg4/EsWyNh So3w== 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 t16si8253123wrq.58.2019.12.19.20.45.52; Thu, 19 Dec 2019 20:45:53 -0800 (PST) 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 47C111BDFD; Fri, 20 Dec 2019 05:45:51 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 548941B9B5 for ; Fri, 20 Dec 2019 05:45:50 +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 878E91FB; Thu, 19 Dec 2019 20:45:49 -0800 (PST) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.14.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7014C3F718; Thu, 19 Dec 2019 20:45:49 -0800 (PST) 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, honnappa.nagarahalli@arm.com Cc: dev@dpdk.org, dharmik.thakkar@arm.com, ruifeng.wang@arm.com, gavin.hu@arm.com, nd@arm.com Date: Thu, 19 Dec 2019 22:45:07 -0600 Message-Id: <20191220044524.32910-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] [PATCH v7 00/17] 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 changes to test cases are significant. The patches 3/17 to 15/17 are created to help with the review. Otherwise, they can be quashed into a single commit. v7 - Merged the test cases to test both legacy APIs and rte_ring_xxx_elem APIs without code duplication (Konstantin, Olivier) - Performance test cases are merged as well (Konstantin, Olivier) - Macros to copy elements are converted into inline functions (Olivier) - Added back the changes to hash and event libraries 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 (17): test/ring: use division for cycle count calculation lib/ring: apis to support configurable element size test/ring: add functional tests for rte_ring_xxx_elem APIs test/ring: test burst APIs with random empty-full test case test/ring: add default, single element test cases test/ring: rte_ring_xxx_elem test cases for exact size ring test/ring: negative test cases for rte_ring_xxx_elem APIs test/ring: remove duplicate test cases test/ring: removed unused variable synchro test/ring: modify single element enq/deq perf test cases test/ring: modify burst enq/deq perf test cases test/ring: modify bulk enq/deq perf test cases test/ring: modify bulk empty deq perf test cases test/ring: modify multi-lcore perf test cases test/ring: adjust run-on-all-cores perf test cases lib/hash: use ring with 32b element size to save memory lib/eventdev: use custom element size ring for event rings app/test/test_ring.c | 1227 +++++++++++--------------- app/test/test_ring.h | 203 +++++ app/test/test_ring_perf.c | 434 +++++---- lib/librte_eventdev/rte_event_ring.c | 147 +-- lib/librte_eventdev/rte_event_ring.h | 45 +- lib/librte_hash/rte_cuckoo_hash.c | 97 +- lib/librte_hash/rte_cuckoo_hash.h | 2 +- lib/librte_ring/Makefile | 3 +- lib/librte_ring/meson.build | 4 + lib/librte_ring/rte_ring.c | 41 +- lib/librte_ring/rte_ring.h | 1 + lib/librte_ring/rte_ring_elem.h | 1002 +++++++++++++++++++++ lib/librte_ring/rte_ring_version.map | 2 + 13 files changed, 2102 insertions(+), 1106 deletions(-) create mode 100644 app/test/test_ring.h create mode 100644 lib/librte_ring/rte_ring_elem.h -- 2.17.1