From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 641E82BA7; Fri, 20 Jul 2018 14:23:25 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id A222921C24; Fri, 20 Jul 2018 08:23:24 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 20 Jul 2018 08:23:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=uozofrFiiC0voY74bUKAm/Yv/q Y1+naLCdChQZpZXMQ=; b=i1KXxrtaYF+hGqdS+aCGUw7k7WgKZvLXjAYhSMu6WZ o0pXN06k0lgs13iBw+I2m+BRuH/mGcOK/sE/XYNrt9DGhOB6kMdn4m/DyiF1tPLA mHcbO80yQpj8MIAhkoHEIYu53gq0D4S+wBaG0eF1sz6Uh0f+5LYR36C6zeh4ZUKu M= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=uozofr FiiC0voY74bUKAm/Yv/qY1+naLCdChQZpZXMQ=; b=S3o9bWbsWTbDw6G+eLTla8 BzBKkZml3nXtB6vnrmt8JnTmB/ezVTnHlvRNGUNOVxg73RowMfBvvA7rA9G9Ki9c MD6TOhto+F87Y0Ck+ZmEl1hrWE8MDG4r16b/jgLduzji7g/klDbcxZZqZTFweZE1 OzatVqpU7fkAOON84DwHT3yy/wieJp3AWhJXiCyrcJ7poFjVHB3nyvNZrLpQjwQ6 FrUMEtzgNvlFUMFjlElze8qqm3zQzMUrKx1gP+vtiIN23XxLtEkkXF3Iv8wNsBRY cGH+RHc6tspOUEHNk+CYR7Vg1FQcn5zj2RA2lealAdNYHXAiy6sFNPRSEgJS/79w == X-ME-Proxy: X-ME-Sender: Received: from xps.localnet (unknown [207.232.18.42]) by mail.messagingengine.com (Postfix) with ESMTPA id D3FE6E4040; Fri, 20 Jul 2018 08:23:19 -0400 (EDT) From: Thomas Monjalon To: Ferruh Yigit Cc: "John W. Linville" , Declan Doherty , Chas Williams , Hemant Agrawal , Shreyansh Jain , Gaetan Rivet , Tetsuya Mukawa , Santosh Shukla , Jerin Jacob , Keith Wiles , Maxime Coquelin , Tiwei Bie , Zhihong Wang , Andrew Rybchenko , dev@dpdk.org, stable@dpdk.org Date: Fri, 20 Jul 2018 14:23:17 +0200 Message-ID: <58927344.bVGVdsIIPO@xps> In-Reply-To: <20180720124421.71277-1-ferruh.yigit@intel.com> References: <20180719164556.93162-1-ferruh.yigit@intel.com> <20180720124421.71277-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v2] drivers/net: fix segfault in 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: , X-List-Received-Date: Fri, 20 Jul 2018 12:23:26 -0000 20/07/2018 14:44, Ferruh Yigit: > --- a/drivers/net/tap/rte_eth_tap.c > +++ b/drivers/net/tap/rte_eth_tap.c > if (rte_eal_process_type() == RTE_PROC_SECONDARY && > strlen(params) == 0) { > - eth_dev = rte_eth_dev_attach_secondary(name); > + eth_dev = rte_eth_vdev_secondary_probe(dev, name, &ops); > if (!eth_dev) { > TAP_LOG(ERR, "Failed to probe %s", name); > return -1; > } > - /* TODO: request info from primary to set up Rx and Tx */ > - eth_dev->dev_ops = &ops; > - rte_eth_dev_probing_finish(eth_dev); > return 0; > } > > --- a/lib/librte_ethdev/rte_ethdev_vdev.h > +++ b/lib/librte_ethdev/rte_ethdev_vdev.h > +static inline struct rte_eth_dev * > +rte_eth_vdev_secondary_probe(struct rte_vdev_device *vdev, > + const char *name, const struct eth_dev_ops *ops) > +{ > + struct rte_eth_dev *eth_dev; > + > + eth_dev = rte_eth_dev_attach_secondary(name); > + if (!eth_dev) > + return NULL; > + > + /* TODO: request info from primary to set up Rx and Tx */ > + eth_dev->dev_ops = ops; > + eth_dev->device = &vdev->device; > + rte_eth_dev_probing_finish(eth_dev); > + return eth_dev; > +} As you can see in the following patch, net/tap: add queues when attaching from secondary process https://patches.dpdk.org/patch/43229/ The synchronization with primary process can be specific to the PMD. It will use some private data and can need IPC call to translate some file descriptors. Moreover, we will need to think about a more complex sync in order to update queues when a process re-configure queues number, and also attach in primary a device created in secondary. We need also to handle hotplug as Qi already proposed. My suggestion: just fix the PMDs without creating an helper. We could design a helper later when we will have thought to the global issue we want to solve.