From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id D7AEA1B6DD; Fri, 13 Oct 2017 16:21:04 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Oct 2017 07:21:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,371,1503385200"; d="scan'208";a="146132916" Received: from mkjastrx-mobl2.ger.corp.intel.com ([10.104.73.214]) by orsmga002.jf.intel.com with SMTP; 13 Oct 2017 07:21:00 -0700 Received: by (sSMTP sendmail emulation); Fri, 13 Oct 2017 16:20:59 +0200 From: Michal Jastrzebski To: cunming.liang@intel.com Cc: dev@dpdk.org, deepak.k.jain@intel.com, Daniel Mrzyglod , stable@dpdk.org Date: Fri, 13 Oct 2017 16:20:57 +0200 Message-Id: <20171013142057.54980-1-michalx.k.jastrzebski@intel.com> X-Mailer: git-send-email 2.12.2 Subject: [dpdk-stable] [PATCH] test/pmd_perf: fix for segmentation fault 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: , X-List-Received-Date: Fri, 13 Oct 2017 14:21:05 -0000 From: Daniel Mrzyglod Error can be reproduce if we run pmd_perf_autotest with more then one device in such way: RTE>>set_rxtx_sc poll_before_xmit RTE>>pmd_perf_autotest two threads are working without synchronization and we are unable to say on which port in the index will came packet. Fixes: 002ade70e933 ("app/test: measure cycles per packet in Rx/Tx") Cc: cunming.liang@intel.com Cc: stable@dpdk.org Signed-off-by: Daniel Mrzyglod --- test/test/test_pmd_perf.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/test/test/test_pmd_perf.c b/test/test/test_pmd_perf.c index a3e29ed..e4d5ca7 100644 --- a/test/test/test_pmd_perf.c +++ b/test/test/test_pmd_perf.c @@ -566,8 +566,8 @@ poll_burst(void *args) unsigned lcore_id; struct rte_mbuf **pkts_burst; uint64_t diff_tsc, cur_tsc; - uint16_t next[RTE_MAX_ETHPORTS]; struct lcore_conf *conf; + uint32_t idx = 0; uint32_t pkt_per_port = *((uint32_t *)args); unsigned i, portid, nb_rx = 0; uint64_t total; @@ -588,11 +588,6 @@ poll_burst(void *args) if (!pkts_burst) return -1; - for (i = 0; i < conf->nb_ports; i++) { - portid = conf->portlist[i]; - next[portid] = i * pkt_per_port; - } - while (!rte_atomic64_read(&start)) ; @@ -601,7 +596,7 @@ poll_burst(void *args) for (i = 0; i < conf->nb_ports; i++) { portid = conf->portlist[i]; nb_rx = rte_eth_rx_burst(portid, 0, - &pkts_burst[next[portid]], + &pkts_burst[idx], MAX_PKT_BURST); if (unlikely(nb_rx == 0)) { timeout--; @@ -609,7 +604,7 @@ poll_burst(void *args) goto timeout; continue; } - next[portid] += nb_rx; + idx += nb_rx; total -= nb_rx; } } @@ -644,7 +639,7 @@ exec_burst(uint32_t flags, int lcore) conf = &lcore_conf[lcore]; pkt_per_port = MAX_TRAFFIC_BURST; - num = pkt_per_port; + num = pkt_per_port * conf->nb_ports; rte_atomic64_init(&start); @@ -661,11 +656,11 @@ exec_burst(uint32_t flags, int lcore) nb_tx = RTE_MIN(MAX_PKT_BURST, num); for (i = 0; i < conf->nb_ports; i++) { portid = conf->portlist[i]; - rte_eth_tx_burst(portid, 0, + nb_tx = rte_eth_tx_burst(portid, 0, &tx_burst[idx], nb_tx); idx += nb_tx; + num -= nb_tx; } - num -= nb_tx; } sleep(5); -- 2.7.4