* [dpdk-stable] [PATCH] test/pmd_perf: fix for segmentation fault @ 2017-10-13 14:20 Michal Jastrzebski 2017-10-27 16:24 ` [dpdk-stable] [PATCH v2] " Daniel Mrzyglod 0 siblings, 1 reply; 4+ messages in thread From: Michal Jastrzebski @ 2017-10-13 14:20 UTC (permalink / raw) To: cunming.liang; +Cc: dev, deepak.k.jain, Daniel Mrzyglod, stable From: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com> 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 <danielx.t.mrzyglod@intel.com> --- 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-stable] [PATCH v2] test/pmd_perf: fix for segmentation fault 2017-10-13 14:20 [dpdk-stable] [PATCH] test/pmd_perf: fix for segmentation fault Michal Jastrzebski @ 2017-10-27 16:24 ` Daniel Mrzyglod 2017-10-31 9:14 ` [dpdk-stable] [dpdk-dev] " Jastrzebski, MichalX K 0 siblings, 1 reply; 4+ messages in thread From: Daniel Mrzyglod @ 2017-10-27 16:24 UTC (permalink / raw) To: dev; +Cc: Daniel Mrzyglod, cunming.liang, stable 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 if first burst was value less than MAX_PKT_BURST in the end we overwrite pkts_burst table for rx which was supposed for another interface. 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 <danielx.t.mrzyglod@intel.com> --- test/test/test_pmd_perf.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/test/test_pmd_perf.c b/test/test/test_pmd_perf.c index a3e29ed..255f260 100644 --- a/test/test/test_pmd_perf.c +++ b/test/test/test_pmd_perf.c @@ -572,6 +572,7 @@ poll_burst(void *args) unsigned i, portid, nb_rx = 0; uint64_t total; uint64_t timeout = MAX_IDLE; + int num[RTE_MAX_ETHPORTS]; lcore_id = rte_lcore_id(); conf = &lcore_conf[lcore_id]; @@ -591,6 +592,7 @@ poll_burst(void *args) for (i = 0; i < conf->nb_ports; i++) { portid = conf->portlist[i]; next[portid] = i * pkt_per_port; + num[portid] = pkt_per_port; } while (!rte_atomic64_read(&start)) @@ -601,8 +603,8 @@ 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]], - MAX_PKT_BURST); + &pkts_burst[next[portid]], + RTE_MIN(MAX_PKT_BURST, num[portid])); if (unlikely(nb_rx == 0)) { timeout--; if (unlikely(timeout == 0)) @@ -610,6 +612,7 @@ poll_burst(void *args) continue; } next[portid] += nb_rx; + num[portid] -= nb_rx; total -= nb_rx; } } @@ -618,7 +621,6 @@ poll_burst(void *args) printf("%"PRIu64" packets lost, IDLE %"PRIu64" times\n", total, MAX_IDLE - timeout); - /* clean up */ total = pkt_per_port * conf->nb_ports - total; for (i = 0; i < total; i++) @@ -644,7 +646,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 +663,12 @@ 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH v2] test/pmd_perf: fix for segmentation fault 2017-10-27 16:24 ` [dpdk-stable] [PATCH v2] " Daniel Mrzyglod @ 2017-10-31 9:14 ` Jastrzebski, MichalX K 2017-11-07 16:56 ` Thomas Monjalon 0 siblings, 1 reply; 4+ messages in thread From: Jastrzebski, MichalX K @ 2017-10-31 9:14 UTC (permalink / raw) To: Mrzyglod, DanielX T, dev Cc: Mrzyglod, DanielX T, Liang, Cunming, stable, Yigit, Ferruh, Jain, Deepak K > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Daniel Mrzyglod > Sent: Friday, October 27, 2017 6:24 PM > To: dev@dpdk.org > Cc: Mrzyglod, DanielX T <danielx.t.mrzyglod@intel.com>; Liang, Cunming > <cunming.liang@intel.com>; stable@dpdk.org > Subject: [dpdk-dev] [PATCH v2] test/pmd_perf: fix for segmentation fault > > 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 > > if first burst was value less than MAX_PKT_BURST in the end we overwrite > pkts_burst table for rx which was supposed for another interface. > > 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 <danielx.t.mrzyglod@intel.com> > --- > test/test/test_pmd_perf.c | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/test/test/test_pmd_perf.c b/test/test/test_pmd_perf.c > index a3e29ed..255f260 100644 > --- a/test/test/test_pmd_perf.c > +++ b/test/test/test_pmd_perf.c > @@ -572,6 +572,7 @@ poll_burst(void *args) > unsigned i, portid, nb_rx = 0; > uint64_t total; > uint64_t timeout = MAX_IDLE; > + int num[RTE_MAX_ETHPORTS]; > > lcore_id = rte_lcore_id(); > conf = &lcore_conf[lcore_id]; > @@ -591,6 +592,7 @@ poll_burst(void *args) > for (i = 0; i < conf->nb_ports; i++) { > portid = conf->portlist[i]; > next[portid] = i * pkt_per_port; > + num[portid] = pkt_per_port; > } > > while (!rte_atomic64_read(&start)) > @@ -601,8 +603,8 @@ 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]], > - MAX_PKT_BURST); > + &pkts_burst[next[portid]], > + RTE_MIN(MAX_PKT_BURST, > num[portid])); > if (unlikely(nb_rx == 0)) { > timeout--; > if (unlikely(timeout == 0)) > @@ -610,6 +612,7 @@ poll_burst(void *args) > continue; > } > next[portid] += nb_rx; > + num[portid] -= nb_rx; > total -= nb_rx; > } > } > @@ -618,7 +621,6 @@ poll_burst(void *args) > > printf("%"PRIu64" packets lost, IDLE %"PRIu64" times\n", > total, MAX_IDLE - timeout); > - > /* clean up */ > total = pkt_per_port * conf->nb_ports - total; > for (i = 0; i < total; i++) > @@ -644,7 +646,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 +663,12 @@ 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 Acked-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com> ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH v2] test/pmd_perf: fix for segmentation fault 2017-10-31 9:14 ` [dpdk-stable] [dpdk-dev] " Jastrzebski, MichalX K @ 2017-11-07 16:56 ` Thomas Monjalon 0 siblings, 0 replies; 4+ messages in thread From: Thomas Monjalon @ 2017-11-07 16:56 UTC (permalink / raw) To: Mrzyglod, DanielX T Cc: dev, Jastrzebski, MichalX K, Liang, Cunming, stable, Yigit, Ferruh, Jain, Deepak K > > 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 > > > > if first burst was value less than MAX_PKT_BURST in the end we overwrite > > pkts_burst table for rx which was supposed for another interface. > > > > 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 <danielx.t.mrzyglod@intel.com> > > Acked-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com> Applied, thanks ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-07 16:56 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-10-13 14:20 [dpdk-stable] [PATCH] test/pmd_perf: fix for segmentation fault Michal Jastrzebski 2017-10-27 16:24 ` [dpdk-stable] [PATCH v2] " Daniel Mrzyglod 2017-10-31 9:14 ` [dpdk-stable] [dpdk-dev] " Jastrzebski, MichalX K 2017-11-07 16:56 ` Thomas Monjalon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).