From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id D2CD5A04FA;
	Sun,  2 Feb 2020 12:09:14 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 456F71BFCF;
	Sun,  2 Feb 2020 12:09:14 +0100 (CET)
Received: from mail-il1-f195.google.com (mail-il1-f195.google.com
 [209.85.166.195]) by dpdk.org (Postfix) with ESMTP id 21B881BFAD;
 Sun,  2 Feb 2020 12:09:13 +0100 (CET)
Received: by mail-il1-f195.google.com with SMTP id s18so10191514iln.0;
 Sun, 02 Feb 2020 03:09:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=cX3++4j6wDTMq9RapY1IMzVR5+Um3O1CTO1/9dkM4pU=;
 b=RKf3L9fntrh+AKbPNmEotecAYdz43V9+NOwtORZItjMDbPrDL2SNp+Hr8krCe9Hnqp
 I/RRGYU0TVyV3+2dL3HmCe2iS9CQ5hPIl5uaLZNUB8cYEHT6LbBxFwp9XCjUOKiqstNN
 9QjeRcDNh3vQLFmB5J+FD9rsTKXUwu195N38MTtjOLyRrSoiC9ZBKJaJU4HmU8m0DHcp
 zTYG1QEXo6E+6EWp5k5wCa/lPc5FdVWa3xmEXsbgTi8g38uFhoOsmbyskqYTMD2lHgPh
 GqqEfCXEUOESvW34Jq1jqnWIiDDgm1PWjbKhuVOWa9H/QielaPy4x1SkCTacapu0Xd4/
 wOxg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=cX3++4j6wDTMq9RapY1IMzVR5+Um3O1CTO1/9dkM4pU=;
 b=Up0gWhhSdtQhMOhyua08DXuOAMchqhCqh0e4nstVsHC+ZWnYowp/JSrdYcxEGNT1DU
 jr4jdKELXDgV6TsrGnfHYnnDZEI2bAGyY5iNWT4zIdaB+eAR8/6m7iJeWdp6+Vk3Xrf+
 4dwTpBs43PZfVpHF5r6QNkwuG1POP49TnVGkEooBwLZtgdV0MNvZEyP2e4hP1870r9V9
 jyme1rHM4nhERU5hMnsDQvqAzusXVRyI/F0Ig3RRbjrua0G9ClwfZlXJ7Z7vouMuc4Nu
 Q98/uEeJJmxHalicWQrptswieHdReAR8w+9GnE9MDKhkE3yzXZLbWbB7J2axQDVpthid
 ohIA==
X-Gm-Message-State: APjAAAW0L+84PS2h6FgJR4hILQvMixkM1rFQntrVS5n4yDZWAI/kRw5w
 81QfHJklLUcDVgim+ILriV2iHzNMGmDAapL0nxI=
X-Google-Smtp-Source: APXvYqwvMKg2CDqeBtbj5Ls0JVGYZ8BlU4semTjJYJ5ztMdwiwIvqvoNEhcx4NE6pWWoY1rP60hi+UXbFigthJngb4c=
X-Received: by 2002:a92:1906:: with SMTP id 6mr18177585ilz.130.1580641752338; 
 Sun, 02 Feb 2020 03:09:12 -0800 (PST)
MIME-Version: 1.0
References: <20200131170201.3236153-1-jerinj@marvell.com>
 <20200131170201.3236153-2-jerinj@marvell.com>
 <20200202023523.2f160b4e@shemminger-XPS-13-9360>
In-Reply-To: <20200202023523.2f160b4e@shemminger-XPS-13-9360>
From: Jerin Jacob <jerinjacobk@gmail.com>
Date: Sun, 2 Feb 2020 16:38:55 +0530
Message-ID: <CALBAE1NGiz_R1ZdwEXixW0Pg=_PEbGxsUUM4MX4KcS6ufLoFbg@mail.gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Jerin Jacob <jerinj@marvell.com>, dpdk-dev <dev@dpdk.org>, 
 Prasun Kapoor <pkapoor@marvell.com>,
 Nithin Dabilpuram <ndabilpuram@marvell.com>, 
 Kiran Kumar K <kirankumark@marvell.com>,
 Pavan Nikhilesh <pbhagavatula@marvell.com>, 
 Narayana Prasad <pathreya@marvell.com>, nsaxena@marvell.com,
 sshankarnara@marvell.com, 
 Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,
 Thomas Monjalon <thomas@monjalon.net>, 
 David Marchand <david.marchand@redhat.com>,
 Ferruh Yigit <ferruh.yigit@intel.com>, 
 Andrew Rybchenko <arybchenko@solarflare.com>,
 Ajit Khaparde <ajit.khaparde@broadcom.com>, 
 "Ye, Xiaolong" <xiaolong.ye@intel.com>, Raslan Darawsheh <rasland@mellanox.com>,
 Maxime Coquelin <maxime.coquelin@redhat.com>, Akhil Goyal <akhil.goyal@nxp.com>,
 Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
 John McNamara <john.mcnamara@intel.com>, 
 "Richardson, Bruce" <bruce.richardson@intel.com>,
 Anatoly Burakov <anatoly.burakov@intel.com>, 
 Gavin Hu <gavin.hu@arm.com>, David Christensen <drc@linux.vnet.ibm.com>, 
 "Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
 Pallavi Kadam <pallavi.kadam@intel.com>, 
 Olivier Matz <olivier.matz@6wind.com>, Gage Eads <gage.eads@intel.com>, 
 "Rao, Nikhil" <nikhil.rao@intel.com>,
 Erik Gabriel Carrillo <erik.g.carrillo@intel.com>, 
 Hemant Agrawal <hemant.agrawal@nxp.com>,
 "Artem V. Andreev" <artem.andreev@oktetlabs.ru>, 
 Stephen Hemminger <sthemmin@microsoft.com>,
 Shahaf Shuler <shahafs@mellanox.com>, 
 "Wiles, Keith" <keith.wiles@intel.com>,
 =?UTF-8?Q?Mattias_R=C3=B6nnblom?= <mattias.ronnblom@ericsson.com>, 
 Jasvinder Singh <jasvinder.singh@intel.com>, 
 Vladimir Medvedkin <vladimir.medvedkin@intel.com>, Ray Kinsella <mdr@ashroe.eu>,
 techboard@dpdk.org
Content-Type: text/plain; charset="UTF-8"
Subject: Re: [dpdk-dev] [RFC PATCH 1/5] graph: introduce graph subsystem
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Sun, Feb 2, 2020 at 4:05 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> On Fri, 31 Jan 2020 22:31:57 +0530
> <jerinj@marvell.com> wrote:
>
> > +     /* Create graph object */
> > +     graph = calloc(1, sizeof(*graph));
> > +     if (graph == NULL)
> > +             set_err(ENOMEM, fail, "failed to calloc graph object");
>
> This won't be safe if used in primary/secondary process model.
> You would need to use rte_calloc etc to allow this.

That memory used only local housekeeping purposes. Down in the
function, it creates a graph reel from
the memzone with all the required data for fast path. see graph_fp_mem_create()

workers/secondary process get the real fast path graph object through
rte_graph_lookup() which
returns the "struct rte_graph *". Followed by invoking
rte_graph_walk(struct rte_graph *graph)
for the graph walk.

struct rte_graph *
rte_graph_lookup(const char *name)
{
        const struct rte_memzone *mz;
        struct rte_graph *rc = NULL;

        mz = rte_memzone_lookup(name);
        if (mz)
                rc = mz->addr;

        return graph_mem_fixup_secondray(rc);
}