From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 48D77A04DC; Tue, 20 Oct 2020 14:18:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DC8BBBAF4; Tue, 20 Oct 2020 14:18:25 +0200 (CEST) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id 5FA05BAD4 for ; Tue, 20 Oct 2020 14:18:24 +0200 (CEST) Received: by mail-wr1-f67.google.com with SMTP id s9so1861631wro.8 for ; Tue, 20 Oct 2020 05:18:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8w5dhTjOyv6IhcksHbMDpLvOiq0tyNQkaRJCO+xOQIM=; b=UkILEtnqp6goGF0+thZT9Sbddhb2uXuNWBce/N1OWfh34+/iYulMh3M22WTvNV/GZ1 ed8zUTKERS6FhVeiMFVbBM/E59chftq229lnFCvMZf2PxKxWcacE0u1LlDteJbYrrPHD JQQ6eM21LzZ3dIkLYL4uWn6xFaHcs1BOHpQzX6zBkB0hMhrUQa9BS+SLKAtWYd++gDX2 2nfMus4HI4ET2/z168aZEeLmoNRAXFI4um46h+M5zdRYLqEqXfj+JR89Tb+mhwgrwgwL Si3NsjQLWejnQcJDMjUl5Zv8FfhRrVHHnMtNCiB6f8PYFEw49CqujM50zLsHB10pG/XH rLjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8w5dhTjOyv6IhcksHbMDpLvOiq0tyNQkaRJCO+xOQIM=; b=XvOqTVXHA9wBPyxymqxyOFZY2eAvn+DBkw+POKwp6xO+WOSE1dcbX/DZBl5ZS46dCV ZJnxXT/zm2sQ0rC8v1m4Sgq2ZbggCjs1iKs26BqMZFcHDk/PW4HblYDovn1aIhgscL1V +n/OiVk79qH77k1RYxDaYSwbDSXV5rNPOgp4e5dwUXu1J51oy8q0nCYG5HEJBXgpnd6b zR1eAscFv6su+j3qxayHvIrTcGnr6E2HW2POysoj6knvEo1h9tR+7rscnS37WY+F6e+4 JtliLwoNqtQ+CIfi78PUGhhAR9W7PrRWCXc8yk/cSzIruL2aS0irjJhMLQU26OktIfxu RLrQ== X-Gm-Message-State: AOAM530R2Nwzb1niqv5ak0H0/LwzqYg8mf/i9TFsBSDr71B7UKAUAm/7 5+e8PdcXs4y7L3iEAkC7rEWtFA== X-Google-Smtp-Source: ABdhPJwQgiClop7J2gaddBz8H0Lo8qD3crkYNSAYekDhernjaX/I8be3RmdOe/9z7OrrjDwbm2gtdQ== X-Received: by 2002:adf:b787:: with SMTP id s7mr3425936wre.390.1603196302981; Tue, 20 Oct 2020 05:18:22 -0700 (PDT) Received: from 6wind.com (2a01cb0c0005a600345636f7e65ed1a0.ipv6.abo.wanadoo.fr. [2a01:cb0c:5:a600:3456:36f7:e65e:d1a0]) by smtp.gmail.com with ESMTPSA id s19sm2996968wmc.0.2020.10.20.05.18.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 05:18:22 -0700 (PDT) Date: Tue, 20 Oct 2020 14:18:21 +0200 From: Olivier Matz To: Stephen Hemminger Cc: anatoly.burakov@intel.com, dev@dpdk.org Message-ID: <20201020121821.GE1898@platinum> References: <20201015172019.3181-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201015172019.3181-1-stephen@networkplumber.org> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH] mbuf: allow dynamic flags to be used by secondary process 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" Hi Stephen, On Thu, Oct 15, 2020 at 10:20:19AM -0700, Stephen Hemminger wrote: > mbuf: allow dynamic flags to be used by secondary process Suggested title: mbuf: fix dynamic flags lookup from secondary process > > The dynamic flag management is broken for multi-process environment. > All calls to lookup dynamic flags or fields will fail in secondary process. > This is because the local pointer to the memzone is not ever initialized. > > Fix it by using the same checks as dynfield_register(). > I.e if shared memory zone has not been looked up already, > then discover it. > > Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags") > Cc: olivier.matz@6wind.com > Signed-off-by: Stephen Hemminger Good catch, please Cc stable for v2. > --- > lib/librte_mbuf/rte_mbuf_dyn.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lib/librte_mbuf/rte_mbuf_dyn.c b/lib/librte_mbuf/rte_mbuf_dyn.c > index 538a43f6959f..ac4801b4d770 100644 > --- a/lib/librte_mbuf/rte_mbuf_dyn.c > +++ b/lib/librte_mbuf/rte_mbuf_dyn.c > @@ -185,7 +185,7 @@ rte_mbuf_dynfield_lookup(const char *name, struct rte_mbuf_dynfield *params) > { > struct mbuf_dynfield_elt *mbuf_dynfield; > > - if (shm == NULL) { > + if (shm == NULL && init_shared_mem() < 0) { > rte_errno = ENOENT; > return -1; > } init_shared_mem() is supposed to be called with tailq lock held. I think the test (shm == NULL && init_shared_mem() < 0) should be moved in __mbuf_dynfield_lookup(). > @@ -384,7 +384,7 @@ rte_mbuf_dynflag_lookup(const char *name, > { > struct mbuf_dynflag_elt *mbuf_dynflag; > > - if (shm == NULL) { > + if (shm == NULL && init_shared_mem() < 0) { > rte_errno = ENOENT; > return -1; > } Same here Thanks, Olivier