From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet Subject: Re: [PATCH 10/11] net/failsafe: fix sub-device ownership race Date: Wed, 9 May 2018 16:03:33 +0200 Message-ID: <20180509140333.kb6pmbno2ixzuj7p@bidouze.vm.6wind.com> References: <20180509094337.26112-1-thomas@monjalon.net> <20180509133013.yxy66njakty2g7y2@bidouze.vm.6wind.com> <10613870.Sdbp1i1ck2@xps> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: Matan Azrad , "dev@dpdk.org" , "stable@dpdk.org" To: Thomas Monjalon Return-path: Received: from mail-wr0-f176.google.com (mail-wr0-f176.google.com [209.85.128.176]) by dpdk.org (Postfix) with ESMTP id 1770F1B415 for ; Wed, 9 May 2018 16:03:49 +0200 (CEST) Received: by mail-wr0-f176.google.com with SMTP id o4-v6so35741220wrm.0 for ; Wed, 09 May 2018 07:03:49 -0700 (PDT) Content-Disposition: inline In-Reply-To: <10613870.Sdbp1i1ck2@xps> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, May 09, 2018 at 03:43:31PM +0200, Thomas Monjalon wrote: > 09/05/2018 15:30, Gaëtan 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. > > > > 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? > > > > 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. > > 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 constraint? > > No actually the issue is when RTE_MAX_ETHPORTS is equal (or superior) to 0x10000. 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. -- Gaëtan Rivet 6WIND