From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [dpdk-stable] [PATCH 10/11] net/failsafe: fix sub-device ownership race Date: Wed, 09 May 2018 23:59:38 +0200 Message-ID: <1590623.ITgNNa1ZXG@xps> References: <20180509094337.26112-1-thomas@monjalon.net> <10613870.Sdbp1i1ck2@xps> <20180509140333.kb6pmbno2ixzuj7p@bidouze.vm.6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: Matan Azrad , "dev@dpdk.org" To: =?ISO-8859-1?Q?Ga=EBtan?= Rivet Return-path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 24A7F1B77A for ; Wed, 9 May 2018 23:59:43 +0200 (CEST) In-Reply-To: <20180509140333.kb6pmbno2ixzuj7p@bidouze.vm.6wind.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 09/05/2018 16:03, Ga=EBtan Rivet: > On Wed, May 09, 2018 at 03:43:31PM +0200, Thomas Monjalon wrote: > > 09/05/2018 15:30, Ga=EBtan Rivet: > > > On Wed, May 09, 2018 at 01:01:58PM +0000, Matan Azrad wrote: > > > > Regarding uint32 > > > > The maximum port id number can be 0xffff. > > > > In this case the loop will be infinite if we use uint16 to iterate = over all the ports. > > >=20 > > > If RTE_MAX_ETHPORTS is set to 0xffff, an array rte_eth_devices[0xffff] > > > would be defined statically, and I think other issues would arise > > > before our being stuck in an infinite loop? > > >=20 > > > In any case, if this had to be fixed, then there should be a > > > BUILD_BUG_ON RTE_MAX_ETHPORTS being 0xffff, in the relevant part of > > > librte_ethdev, instead of relying on librte_ethdev users skirting > > > shortfalls of the library. Anyone iterating on port IDs should expect= the > > > port_id type to be sufficient to hold this information. > >=20 > > Interesting thought. > > I vote for keeping Matan's option as it is correct, > > and will accept a patch in 18.08 for your option (BUILD_BUG_ON). > > Maybe we should send a deprecation notice before limiting the max > > number of ports to 0xfffe? Or is it ridiculous for such unlikely constr= aint? > >=20 > >=20 >=20 > No actually the issue is when RTE_MAX_ETHPORTS is equal (or superior) to > 0x10000. >=20 > If this is an issue that you think is worth having a workaround here, > you should also consider that rte_eth_find_next_owned_by (and > rte_eth_find_next, even if this one should be phased out), would also > result in an overflow and an infinite loop. You get a point. I will remove the workaround uint32_t in v2, so all the related issues can be fixed at once in a separate patch using BUILD_BUG_ON.