From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 72B70A0C49; Tue, 15 Jun 2021 11:18:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E2AD64067A; Tue, 15 Jun 2021 11:18:19 +0200 (CEST) Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) by mails.dpdk.org (Postfix) with ESMTP id 45D4240140 for ; Tue, 15 Jun 2021 11:18:18 +0200 (CEST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id ABA025807F7; Tue, 15 Jun 2021 05:18:15 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 15 Jun 2021 05:18:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm1; bh= o6Vvbm4AgZCbrns3GAzNNTwUcSMkU+v6zPU43PX+d6E=; b=ki3Irs2Sgkfa5UNB s4UXhwv30QNpPvuAMBDB0hGWJoPD6aNY/gxGmdtmUPYjTyGzSGPYKG/wMziIUTA3 j7Cc7uV5I3PjMA0M/wUNUp7eJEI3NCTQMhitGJGpkvSG80FPuxdlEVVDRzxkQfb9 wdg33+QzqWCiBDu40JfGieuTv8H57AdnHvCiUrZrxZc8XMQ8CYdg3iWyBqFB3DGh glj5SgZCqQmAVmAfbhrHg/z60xj6gYFk/GMjO3BQkfgphRBsvXGIc2DO0onIR7Cs m1S1T0RHQdPvzW1b7EoeLSimcMO8tg3WBV4r0xQCRiEvm7tobuZbZg+VpME43Wkh 2M4tPw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=o6Vvbm4AgZCbrns3GAzNNTwUcSMkU+v6zPU43PX+d 6E=; b=WdWUmZYXlA8bKLwIjMsk/ZGPO/99N751sRWhvpJjyrB2VELHpENxQ3B+P 54ejXqsieqc1BDg+Qd8L5eNJuPG4146+46pX6QDSvt7pXxIfHcoxQm71011cBcCG cMqIXjBdf9BeYsj6ex6cdL6cX8pLWs+Q3QibkGIxH3Vj0DCUJ64w4q/iSzjWjDfG lGm73VUQOtIQJ6WOHilFpfdiQrnhiw2/ttaKwHMFV+kvpGnqqs/1SRBElhvbF9Is h7LV090y4gvT5/OamrFx6D2wWKXRx1p7bJATb8QJl1EZC2DGnzjyHbToxXFJ7TU+ 79n9xrFlv0ry1r8Kp1rzMavq3moSw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedvjedgudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepkefhgfevjedvtddtteekieekveeivdeiueejffdtffejgfejgeei ieefueekteetnecuffhomhgrihhnpehfugdrihhonecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgv th X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 15 Jun 2021 05:18:13 -0400 (EDT) From: Thomas Monjalon To: Jerin Jacob Cc: "Ananyev, Konstantin" , "Richardson, Bruce" , Morten =?ISO-8859-1?Q?Br=F8rup?= , "dev@dpdk.org" , "olivier.matz@6wind.com" , "andrew.rybchenko@oktetlabs.ru" , "honnappa.nagarahalli@arm.com" , "Yigit, Ferruh" , "jerinj@marvell.com" , "gakhil@marvell.com" Date: Tue, 15 Jun 2021 11:18:11 +0200 Message-ID: <1725976.ZNbi1HEfbS@thomas> In-Reply-To: References: <20210614105839.3379790-1-thomas@monjalon.net> <52380960.E65VIl4Blx@thomas> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] parray: introduce internal API for dynamic arrays X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" 15/06/2021 10:00, Jerin Jacob: > On Tue, Jun 15, 2021 at 12:22 PM Thomas Monjalon wrote: > > 14/06/2021 17:48, Jerin Jacob: > > > On Mon, Jun 14, 2021 at 8:29 PM Ananyev, Konstantin > > > wrote: > > > > > 14/06/2021 15:15, Bruce Richardson: > > > > > > While I dislike the hard-coded limits in DPDK, I'm also not convinced that > > > > > > we should switch away from the flat arrays or that we need fully dynamic > > > > > > arrays that grow/shrink at runtime for ethdevs. I would suggest a half-way > > > > > > house here, where we keep the ethdevs as an array, but one allocated/sized > > > > > > at runtime rather than statically. This would allow us to have a > > > > > > compile-time default value, but, for use cases that need it, allow use of a > > > > > > flag e.g. "max-ethdevs" to change the size of the parameter given to the > > > > > > malloc call for the array. This max limit could then be provided to apps > > > > > > too if they want to match any array sizes. [Alternatively those apps could > > > > > > check the provided size and error out if the size has been increased beyond > > > > > > what the app is designed to use?]. There would be no extra dereferences per > > > > > > rx/tx burst call in this scenario so performance should be the same as > > > > > > before (potentially better if array is in hugepage memory, I suppose). > > > > > > > > > > I think we need some benchmarks to decide what is the best tradeoff. > > > > > I spent time on this implementation, but sorry I won't have time for benchmarks. > > > > > Volunteers? > > > > > > > > I had only a quick look at your approach so far. > > > > But from what I can read, in MT environment your suggestion will require > > > > extra synchronization for each read-write access to such parray element (lock, rcu, ...). > > > > I think what Bruce suggests will be much ligther, easier to implement and less error prone. > > > > At least for rte_ethdevs[] and friends. > > > > > > +1 > > > > Please could you have a deeper look and tell me why we need more locks? > > We don't need more locks (It is fat mutex) now in the implementation. > > If it needs to use in fastpath, we need more state of art > synchronization like RCU. > > Also, you can take look at VPP dynamic array implementation which is > used in fastpath. > > https://docs.fd.io/vpp/21.10/db/d65/vec_8h.html > > So the question is the use case for this API. Is it for slowpath item > like ethdev[] memory > or fastpath items like holding an array of mbuf etc. As I replied to Morten, it is for read in fast path and alloc/free in slow path. I should highlight this in the commit log if there is a v2. That's why there is a mutex in alloc/free and nothing in read access. > > The element pointers doesn't change. > > Only the array pointer change at resize, > > but the old one is still usable until the next resize. > > I think we don't need more.