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 5B6B9A04DC for ; Mon, 26 Oct 2020 15:49:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 07DB72BB5; Mon, 26 Oct 2020 15:49:21 +0100 (CET) Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by dpdk.org (Postfix) with ESMTP id B8F7C1D9E for ; Mon, 26 Oct 2020 15:49:17 +0100 (CET) Received: by mail-pf1-f193.google.com with SMTP id w21so6307255pfc.7 for ; Mon, 26 Oct 2020 07:49:17 -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=balUPoRC1/m9zPnPYXTKk7HJtEyFLyAGBWloQ32IbfmejZzItpU6xqLUWmJ9vX5h4b TAoHpOt6ov2/MISJDOOwif94psC/NwhGw0qHGfh+MA/M8IkmOhZU145VY1FZVDF1XeVl Y+rG/FlT5IXmzkesZUWX+1XL1YdYa4hOIZDupSjBvrxURadN3L4FnfSbvg7p/r0VFbxT sDJsAEOft2HLj49Vo+JnKXoijtNsqaMgtNviiNZzypDfU3vbBS1ZLMqG9svN4M5J00V1 2WYhrWSCzxUay6hH7ejnUL4ji+oNstOny/HiR8ela0p22/L+E/7WP9Tc4xfwZkquEvSW dUKw== X-Gm-Message-State: AOAM531xaE8u+KCCWVrjnCTFfDtYl2pHIwVL2lZ/hnxChQaSWcc0cLTu 4cOzg2CJ6QNuoGRDee4EDJMELQ== 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-stable] [PATCH v3] mbuf: fix dynamic flags lookup from secondary process X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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.