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 2E771A04DC; Mon, 26 Oct 2020 15:49:21 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D4F1429C6; Mon, 26 Oct 2020 15:49:18 +0100 (CET) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id BB10C29C6 for ; Mon, 26 Oct 2020 15:49:16 +0100 (CET) Received: by mail-pf1-f196.google.com with SMTP id c20so6309060pfr.8 for ; Mon, 26 Oct 2020 07:49:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cfNWhY7G7Ri6gKTwZ/Z5MeUlh7nSqmcG+77+f4AZk6Y=; b=IWag/UJO07xQ7NRKMuC2WXiaNaS7hr0Yp8gz6ITh1hN+kOVqkQMUvXmajJEQUezvQn hMKJggQGbsk6R4kqIBZQ/WHG4lh+Kpv/nAjCxBX+V+f5TfFL5pnbIUvtS8yeKEaDAzIR TDHsjb/HUTHJb+A+jn3SSG/iMZWNTTxg63E1CMVlrkRsKAxPnKogK5IzWPhEvHKpYS+U d+DishYVKqbiTvkvC91sgX24DPJ0tCys+r6glA+4qimmVAomXaqLjv869qSbjuLZ27qZ h/N5jhFMosAKk/YF0U9Yq1gMjK6md9PsLIf3QLI79xigNqehh0s3fbX45h4C53z7QLrg QxQg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=cfNWhY7G7Ri6gKTwZ/Z5MeUlh7nSqmcG+77+f4AZk6Y=; b=XAMn+Mv31lkWtSIfWoZpZeA8GunxLoXTAF0MCAY+FZAmD4GCnlyd7Uo6FxJGUvlvhG qMRteUQi1lSjmQBOeZNH/HDW0wKkpQVIOUMNAAJ7TNOMMbQL0wuo1dXkJXfa39L7hRaZ NaozhcdwJY+c6mpH5Iiqt0hCAbCqy0aDJfnno/Yp1fUZ6gM/rzS74cfHiqV2L3YtAnRd VALaASq/3IBSfKvLB0QeoB2cd5uhpZSbEQz7sQJRaRdzyVNNhDgZ9iAILqSI1uyw7Yuq aizUsl+vP2PxyWVNJjSbrjej5Vvbn2k21gYhVuFxC7rpanYHb2bq+dBGxhlbGPa7kaPF yESA== X-Gm-Message-State: AOAM532uTVxf1ZbbXBk3t6ameLj91x/AYiA4ZsF0tj8Kstw9aKEymS8Z 0ouGfX3q8vNPNTOA/JzQYDiln7+ZVkrgbzjN X-Google-Smtp-Source: ABdhPJxnFYLImNcU+Sy6xuAWcupG+xHMZD9xvuJn70JLdxdkVemQ4P4OC5j4RR3JfFKLCGsNivbF0Q== X-Received: by 2002:a62:e113:0:b029:152:69aa:6a08 with SMTP id q19-20020a62e1130000b029015269aa6a08mr11580909pfh.14.1603723755818; Mon, 26 Oct 2020 07:49:15 -0700 (PDT) Received: from hermes.local (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id z5sm11862921pfn.20.2020.10.26.07.49.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Oct 2020 07:49:15 -0700 (PDT) Date: Mon, 26 Oct 2020 07:49:07 -0700 From: Stephen Hemminger To: Olivier Matz Cc: dev@dpdk.org, stable@dpdk.org Message-ID: <20201026074907.6f7da565@hermes.local> In-Reply-To: <20201026103935.GL1898@platinum> References: <20201015172019.3181-1-stephen@networkplumber.org> <20201024004331.25043-1-stephen@networkplumber.org> <20201026103935.GL1898@platinum> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v3] mbuf: fix dynamic flags lookup from 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" On Mon, 26 Oct 2020 11:39:35 +0100 Olivier Matz wrote: > Hi Stephen, > > On Fri, Oct 23, 2020 at 05:43:31PM -0700, Stephen Hemminger wrote: > > The dynamic flag management is broken if rte_mbuf_dynflag_lookup() > > is done in a secondary process 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 > > --- > > > > v3 - change title, fix one extra whitespace > > > > lib/librte_mbuf/rte_mbuf_dyn.c | 20 ++++++++------------ > > 1 file changed, 8 insertions(+), 12 deletions(-) > > > > diff --git a/lib/librte_mbuf/rte_mbuf_dyn.c b/lib/librte_mbuf/rte_mbuf_dyn.c > > index 538a43f6959f..554ec5a1ca4f 100644 > > --- a/lib/librte_mbuf/rte_mbuf_dyn.c > > +++ b/lib/librte_mbuf/rte_mbuf_dyn.c > > @@ -185,13 +185,11 @@ rte_mbuf_dynfield_lookup(const char *name, struct rte_mbuf_dynfield *params) > > { > > struct mbuf_dynfield_elt *mbuf_dynfield; > > > > - if (shm == NULL) { > > - rte_errno = ENOENT; > > - return -1; > > - } > > - > > rte_mcfg_tailq_read_lock(); > > - mbuf_dynfield = __mbuf_dynfield_lookup(name); > > + if (shm == NULL && init_shared_mem() < 0) > > + mbuf_dynfield = NULL; > > + else > > + mbuf_dynfield = __mbuf_dynfield_lookup(name); > > rte_mcfg_tailq_read_unlock(); > > > > if (mbuf_dynfield == NULL) { > > rte_errno = ENOENT; > > return -1; > > There is still a small corner case here: on a primary process, > init_shared_mem() can return -1 in case rte_memzone_reserve_aligned() > returns a NULL memzone. In this situation, rte_errno is set by the > memzone layer by overriden to ENOENT. > > Maybe something like this is better, what do you think? Sure, for what I was using rte_errno was not important. And since it was previously broken lets get it fixed.