From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 99C5C37B3 for ; Mon, 26 Sep 2016 16:59:25 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP; 26 Sep 2016 07:59:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,400,1470726000"; d="scan'208";a="1046048849" Received: from gklab-246-021.igk.intel.com (HELO HANLANCREEK9755-232) ([10.217.246.21]) by fmsmga001.fm.intel.com with SMTP; 26 Sep 2016 07:59:11 -0700 Received: by HANLANCREEK9755-232 (sSMTP sendmail emulation); Mon, 26 Sep 2016 16:53:08 +0200 From: Marcin Kerlin To: dev@dpdk.org Cc: pablo.de.lara.guarch@intel.com, thomas.monjalon@6wind.com, Marcin Kerlin Date: Mon, 26 Sep 2016 16:53:04 +0200 Message-Id: <1474901586-8706-1-git-send-email-marcinx.kerlin@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1474381895-16066-2-git-send-email-marcinx.kerlin@intel.com> References: <1474381895-16066-2-git-send-email-marcinx.kerlin@intel.com> Subject: [dpdk-dev] [PATCH v3 0/2] app/testpmd: improve multiprocess support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2016 14:59:26 -0000 This patch ensure not overwrite device data in the multiprocess application. 1)Changes in the library introduces continuity in array rte_eth_dev_data[] shared between all processes. Secondary process adds new entries in free space instead of overwriting existing entries. 2)Changes in application testpmd allow secondary process to attach the mempool created by primary process rather than create new and in the case of quit or force quit to free devices data from shared array rte_eth_dev_data[]. ------------------------- How to reproduce the bug: 1) Run primary process: -c 0xf -n 4 --socket-mem='512,0' -w 03:00.1 -w 03:00.0 --proc-type=primary --file-prefix=xz1 -- -i (gdb) print rte_eth_devices[0].data.name $52 = "3:0.1" (gdb) print rte_eth_devices[1].data.name $53 = "3:0.0" 2) Run secondary process: -c 0xf0 --socket-mem='512,0' -n 4 -v -b 03:00.1 -b 03:00.0 -b 01:00.0 -b 01:00.0 --vdev 'eth_pcap0,rx_pcap=/var/log/device1.pcap,tx_pcap=/var/log/device2.pcap' --proc-type=secondary --file-prefix=xz1 -- -i (gdb) print rte_eth_devices[0].data.name $52 = "eth_pcap0" (gdb) print rte_eth_devices[1].data.name $53 = "eth_pcap1" 3) Go back to the primary and re-check: (gdb) print rte_eth_devices[0].data.name $54 = "eth_pcap0" (gdb) print rte_eth_devices[1].data.name $55 = "eth_pcap1" It means that secondary process overwrite data of primary process. This patch fix it and now if we go back to the primary and re-check then everything is fine: (gdb) print rte_eth_devices[0].data.name $56 = "3:0.1" (gdb) print rte_eth_devices[1].data.name $57 = "3:0.0" So after this fix structure rte_eth_dev_data[] will keep all data one after the other instead of overwriting: (gdb) print rte_eth_dev_data[0].name $52 = "3:0.1" (gdb) print rte_eth_dev_data[1].name $53 = "3:0.0" (gdb) print rte_eth_dev_data[2].name $54 = "eth_pcap0" (gdb) print rte_eth_dev_data[3].name $55 = "eth_pcap1" and so on will be append in the next indexes If secondary process will be turned off then also will be deleted from array: (gdb) print rte_eth_dev_data[0].name $52 = "3:0.1" (gdb) print rte_eth_dev_data[1].name $53 = "3:0.0" (gdb) print rte_eth_dev_data[2].name $54 = "" (gdb) print rte_eth_dev_data[3].name $55 = "" this also allows re-use index 2 and 3 for next another process ------------------------- Breaking ABI: Changes in the library librte_ether causes extending existing structure rte_eth_dev_data with a new field lock. The reason is that this structure is sharing between all the processes so it should be protected against attempting to write from two different processes. Tomasz Kulasek sent announce ABI change in librte_ether on 21 July 2016. I would like to join to this breaking ABI, if it is possible. v2: * fix syntax error in version script v3: * changed scope of function * improved description Marcin Kerlin (2): librte_ether: ensure not overwrite device data in mp app app/testpmd: improve handling of multiprocess app/test-pmd/testpmd.c | 36 +++++++++++++- app/test-pmd/testpmd.h | 1 + lib/librte_ether/rte_ethdev.c | 90 +++++++++++++++++++++++++++++++--- lib/librte_ether/rte_ethdev.h | 24 +++++++++ lib/librte_ether/rte_ether_version.map | 7 +++ 5 files changed, 148 insertions(+), 10 deletions(-) -- 1.9.1