* [dpdk-dev] [PATCH 1/2] app/testpmd: fix crash at mbuf pool creation @ 2017-04-24 12:33 Olivier Matz 2017-04-24 12:33 ` [dpdk-dev] [PATCH 2/2] app/testpmd: fix number of mbufs in pool Olivier Matz 2017-04-28 8:51 ` [dpdk-dev] [PATCH 1/2] app/testpmd: fix crash at mbuf pool creation Wu, Jingjing 0 siblings, 2 replies; 5+ messages in thread From: Olivier Matz @ 2017-04-24 12:33 UTC (permalink / raw) To: dev, jingjing.wu; +Cc: bruce.richardson, stable Since commit 999b2ee0fe45 ("app/testpmd: enable NUMA support by default"), testpmd is started with numa enabled by default. This highlights a floating point exception when started with --total-num-mbufs without any port (division by 0). This bug was already triggered before this commit if the --no-numa option was given. This commit adds a check of the nb_ports value before doing the division. By looking at this code, it appears that the creation of the mbuf pool is not consistent for the number of mbufs depending on the configuration. This is fixed in the next commit. Fixes: b6ea6408fbc7 ("ethdev: store numa_node per device") CC: stable@dpdk.org Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/testpmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 3a573480d..f61f31344 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -597,7 +597,7 @@ init_config(void) uint8_t i; unsigned int nb_mbuf; - if (param_total_num_mbufs) + if (param_total_num_mbufs && nb_ports != 0) nb_mbuf_per_pool = nb_mbuf_per_pool/nb_ports; for (i = 0; i < max_socket; i++) { -- 2.11.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH 2/2] app/testpmd: fix number of mbufs in pool 2017-04-24 12:33 [dpdk-dev] [PATCH 1/2] app/testpmd: fix crash at mbuf pool creation Olivier Matz @ 2017-04-24 12:33 ` Olivier Matz 2017-04-28 9:04 ` Wu, Jingjing 2017-04-28 8:51 ` [dpdk-dev] [PATCH 1/2] app/testpmd: fix crash at mbuf pool creation Wu, Jingjing 1 sibling, 1 reply; 5+ messages in thread From: Olivier Matz @ 2017-04-24 12:33 UTC (permalink / raw) To: dev, jingjing.wu; +Cc: bruce.richardson, stable The number of mbufs in pools is not consistent depending on the options passed by the user and the number of ports, especially in numa mode, when the number of mbuf is specified by the user. When the user specifies the number of mbuf (per pool), it should overrides the default value. - before the patch ./build/app/testpmd -- -i <mbuf_pool_socket_0>: n=331456, size=2176, socket=0 <mbuf_pool_socket_1>: n=331456, size=2176, socket=1 ./build/app/testpmd -- --total-num-mbufs=8000 -i <mbuf_pool_socket_0>: n=256000, size=2176, socket=0 <mbuf_pool_socket_1>: n=256000, size=2176, socket=1 # BAD, should be n=8000 for each socket ./build/app/testpmd -- --no-numa -i <mbuf_pool_socket_0>: n=331456, size=2176, socket=0 ./build/app/testpmd -- --no-numa --total-num-mbufs=8000 -i <mbuf_pool_socket_0>: n=8000, size=2176, socket=0 ./build/app/testpmd --vdev=eth_null0 --vdev=eth_null1 -- -i <mbuf_pool_socket_0>: n=331456, size=2176, socket=0 <mbuf_pool_socket_1>: n=331456, size=2176, socket=1 ./build/app/testpmd --vdev=eth_null0 --vdev=eth_null1 -- \ --total-num-mbufs=8000 -i <mbuf_pool_socket_0>: n=128000, size=2176, socket=0 <mbuf_pool_socket_1>: n=128000, size=2176, socket=1 # BAD, should be n=8000 for each socket ./build/app/testpmd --vdev=eth_null0 --vdev=eth_null1 -- --no-numa -i <mbuf_pool_socket_0>: n=331456, size=2176, socket=0 ./build/app/testpmd --vdev=eth_null0 --vdev=eth_null1 -- --no-numa \ --total-num-mbufs=8000 -i <mbuf_pool_socket_0>: n=8000, size=2176, socket=0 - after the patch ./build/app/testpmd -- -i <mbuf_pool_socket_0>: n=331456, size=2176, socket=0 <mbuf_pool_socket_1>: n=331456, size=2176, socket=1 ./build/app/testpmd -- --total-num-mbufs=8000 -i <mbuf_pool_socket_0>: n=8000, size=2176, socket=0 <mbuf_pool_socket_1>: n=8000, size=2176, socket=1 ./build/app/testpmd -- --no-numa -i <mbuf_pool_socket_0>: n=331456, size=2176, socket=0 ./build/app/testpmd -- --no-numa --total-num-mbufs=8000 -i <mbuf_pool_socket_0>: n=8000, size=2176, socket=0 ./build/app/testpmd --vdev=eth_null0 --vdev=eth_null1 -- -i <mbuf_pool_socket_0>: n=331456, size=2176, socket=0 <mbuf_pool_socket_1>: n=331456, size=2176, socket=1 ./build/app/testpmd --vdev=eth_null0 --vdev=eth_null1 -- \ --total-num-mbufs=8000 -i <mbuf_pool_socket_0>: n=8000, size=2176, socket=0 <mbuf_pool_socket_1>: n=8000, size=2176, socket=1 ./build/app/testpmd --vdev=eth_null0 --vdev=eth_null1 -- --no-numa -i <mbuf_pool_socket_0>: n=331456, size=2176, socket=0 ./build/app/testpmd --vdev=eth_null0 --vdev=eth_null1 -- --no-numa \ --total-num-mbufs=8000 -i <mbuf_pool_socket_0>: n=8000, size=2176, socket=0 Fixes: b6ea6408fbc7 ("ethdev: store numa_node per device") CC: stable@dpdk.org Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/testpmd.c | 65 +++++++++++++++++++++----------------------------- 1 file changed, 27 insertions(+), 38 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index f61f31344..0c6a50ea3 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -543,34 +543,6 @@ init_config(void) fwd_lcores[lc_id]->cpuid_idx = lc_id; } - /* - * Create pools of mbuf. - * If NUMA support is disabled, create a single pool of mbuf in - * socket 0 memory by default. - * Otherwise, create a pool of mbuf in the memory of sockets 0 and 1. - * - * Use the maximum value of nb_rxd and nb_txd here, then nb_rxd and - * nb_txd can be configured at run time. - */ - if (param_total_num_mbufs) - nb_mbuf_per_pool = param_total_num_mbufs; - else { - nb_mbuf_per_pool = RTE_TEST_RX_DESC_MAX + (nb_lcores * mb_mempool_cache) - + RTE_TEST_TX_DESC_MAX + MAX_PKT_BURST; - - if (!numa_support) - nb_mbuf_per_pool = - (nb_mbuf_per_pool * RTE_MAX_ETHPORTS); - } - - if (!numa_support) { - if (socket_num == UMA_NO_CONFIG) - mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, 0); - else - mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, - socket_num); - } - RTE_ETH_FOREACH_DEV(pid) { port = &ports[pid]; rte_eth_dev_info_get(pid, &port->dev_info); @@ -593,20 +565,37 @@ init_config(void) port->need_reconfig_queues = 1; } + /* + * Create pools of mbuf. + * If NUMA support is disabled, create a single pool of mbuf in + * socket 0 memory by default. + * Otherwise, create a pool of mbuf in the memory of sockets 0 and 1. + * + * Use the maximum value of nb_rxd and nb_txd here, then nb_rxd and + * nb_txd can be configured at run time. + */ + if (param_total_num_mbufs) + nb_mbuf_per_pool = param_total_num_mbufs; + else { + nb_mbuf_per_pool = RTE_TEST_RX_DESC_MAX + + (nb_lcores * mb_mempool_cache) + + RTE_TEST_TX_DESC_MAX + MAX_PKT_BURST; + nb_mbuf_per_pool *= RTE_MAX_ETHPORTS; + } + if (numa_support) { uint8_t i; - unsigned int nb_mbuf; - - if (param_total_num_mbufs && nb_ports != 0) - nb_mbuf_per_pool = nb_mbuf_per_pool/nb_ports; - for (i = 0; i < max_socket; i++) { - nb_mbuf = (nb_mbuf_per_pool * RTE_MAX_ETHPORTS); - if (nb_mbuf) - mbuf_pool_create(mbuf_data_size, - nb_mbuf,i); - } + for (i = 0; i < max_socket; i++) + mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, i); + } else { + if (socket_num == UMA_NO_CONFIG) + mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, 0); + else + mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, + socket_num); } + init_port_config(); /* -- 2.11.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH 2/2] app/testpmd: fix number of mbufs in pool 2017-04-24 12:33 ` [dpdk-dev] [PATCH 2/2] app/testpmd: fix number of mbufs in pool Olivier Matz @ 2017-04-28 9:04 ` Wu, Jingjing 0 siblings, 0 replies; 5+ messages in thread From: Wu, Jingjing @ 2017-04-28 9:04 UTC (permalink / raw) To: Olivier Matz, dev; +Cc: Richardson, Bruce, stable > -----Original Message----- > From: Olivier Matz [mailto:olivier.matz@6wind.com] > Sent: Monday, April 24, 2017 8:34 PM > To: dev@dpdk.org; Wu, Jingjing <jingjing.wu@intel.com> > Cc: Richardson, Bruce <bruce.richardson@intel.com>; stable@dpdk.org > Subject: [PATCH 2/2] app/testpmd: fix number of mbufs in pool > > The number of mbufs in pools is not consistent depending on the options passed > by the user and the number of ports, especially in numa mode, when the number > of mbuf is specified by the user. > > When the user specifies the number of mbuf (per pool), it should overrides the > default value. > > - before the patch > > ./build/app/testpmd -- -i > <mbuf_pool_socket_0>: n=331456, size=2176, socket=0 > <mbuf_pool_socket_1>: n=331456, size=2176, socket=1 > > ./build/app/testpmd -- --total-num-mbufs=8000 -i > <mbuf_pool_socket_0>: n=256000, size=2176, socket=0 > <mbuf_pool_socket_1>: n=256000, size=2176, socket=1 > # BAD, should be n=8000 for each socket > > ./build/app/testpmd -- --no-numa -i > <mbuf_pool_socket_0>: n=331456, size=2176, socket=0 > > ./build/app/testpmd -- --no-numa --total-num-mbufs=8000 -i > <mbuf_pool_socket_0>: n=8000, size=2176, socket=0 > > ./build/app/testpmd --vdev=eth_null0 --vdev=eth_null1 -- -i > <mbuf_pool_socket_0>: n=331456, size=2176, socket=0 > <mbuf_pool_socket_1>: n=331456, size=2176, socket=1 > > ./build/app/testpmd --vdev=eth_null0 --vdev=eth_null1 -- \ > --total-num-mbufs=8000 -i > <mbuf_pool_socket_0>: n=128000, size=2176, socket=0 > <mbuf_pool_socket_1>: n=128000, size=2176, socket=1 > # BAD, should be n=8000 for each socket > > ./build/app/testpmd --vdev=eth_null0 --vdev=eth_null1 -- --no-numa -i > <mbuf_pool_socket_0>: n=331456, size=2176, socket=0 > > ./build/app/testpmd --vdev=eth_null0 --vdev=eth_null1 -- --no-numa \ > --total-num-mbufs=8000 -i > <mbuf_pool_socket_0>: n=8000, size=2176, socket=0 > > - after the patch > > ./build/app/testpmd -- -i > <mbuf_pool_socket_0>: n=331456, size=2176, socket=0 > <mbuf_pool_socket_1>: n=331456, size=2176, socket=1 > > ./build/app/testpmd -- --total-num-mbufs=8000 -i > <mbuf_pool_socket_0>: n=8000, size=2176, socket=0 > <mbuf_pool_socket_1>: n=8000, size=2176, socket=1 > > ./build/app/testpmd -- --no-numa -i > <mbuf_pool_socket_0>: n=331456, size=2176, socket=0 > > ./build/app/testpmd -- --no-numa --total-num-mbufs=8000 -i > <mbuf_pool_socket_0>: n=8000, size=2176, socket=0 > > ./build/app/testpmd --vdev=eth_null0 --vdev=eth_null1 -- -i > <mbuf_pool_socket_0>: n=331456, size=2176, socket=0 > <mbuf_pool_socket_1>: n=331456, size=2176, socket=1 > > ./build/app/testpmd --vdev=eth_null0 --vdev=eth_null1 -- \ > --total-num-mbufs=8000 -i > <mbuf_pool_socket_0>: n=8000, size=2176, socket=0 > <mbuf_pool_socket_1>: n=8000, size=2176, socket=1 > > ./build/app/testpmd --vdev=eth_null0 --vdev=eth_null1 -- --no-numa -i > <mbuf_pool_socket_0>: n=331456, size=2176, socket=0 > > ./build/app/testpmd --vdev=eth_null0 --vdev=eth_null1 -- --no-numa \ > --total-num-mbufs=8000 -i > <mbuf_pool_socket_0>: n=8000, size=2176, socket=0 > > Fixes: b6ea6408fbc7 ("ethdev: store numa_node per device") > > CC: stable@dpdk.org > Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Jingjing Wu <jingjing.wu@intel.com> ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] app/testpmd: fix crash at mbuf pool creation 2017-04-24 12:33 [dpdk-dev] [PATCH 1/2] app/testpmd: fix crash at mbuf pool creation Olivier Matz 2017-04-24 12:33 ` [dpdk-dev] [PATCH 2/2] app/testpmd: fix number of mbufs in pool Olivier Matz @ 2017-04-28 8:51 ` Wu, Jingjing 2017-05-01 13:18 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon 1 sibling, 1 reply; 5+ messages in thread From: Wu, Jingjing @ 2017-04-28 8:51 UTC (permalink / raw) To: Olivier Matz, dev; +Cc: Richardson, Bruce, stable > -----Original Message----- > From: Olivier Matz [mailto:olivier.matz@6wind.com] > Sent: Monday, April 24, 2017 8:34 PM > To: dev@dpdk.org; Wu, Jingjing <jingjing.wu@intel.com> > Cc: Richardson, Bruce <bruce.richardson@intel.com>; stable@dpdk.org > Subject: [PATCH 1/2] app/testpmd: fix crash at mbuf pool creation > > Since > commit 999b2ee0fe45 ("app/testpmd: enable NUMA support by default"), > testpmd is started with numa enabled by default. This highlights a floating point > exception when started with --total-num-mbufs without any port (division by 0). > This bug was already triggered before this commit if the --no-numa option was > given. > > This commit adds a check of the nb_ports value before doing the division. By > looking at this code, it appears that the creation of the mbuf pool is not > consistent for the number of mbufs depending on the configuration. This is fixed > in the next commit. > > Fixes: b6ea6408fbc7 ("ethdev: store numa_node per device") > > CC: stable@dpdk.org > Signed-off-by: Olivier Matz <olivier.matz@6wind.com> > --- > app/test-pmd/testpmd.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > 3a573480d..f61f31344 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -597,7 +597,7 @@ init_config(void) > uint8_t i; > unsigned int nb_mbuf; > > - if (param_total_num_mbufs) > + if (param_total_num_mbufs && nb_ports != 0) > nb_mbuf_per_pool = nb_mbuf_per_pool/nb_ports; > > for (i = 0; i < max_socket; i++) { Acked-by: Jingjing Wu <jingjing.wu@intel.com> ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH 1/2] app/testpmd: fix crash at mbuf pool creation 2017-04-28 8:51 ` [dpdk-dev] [PATCH 1/2] app/testpmd: fix crash at mbuf pool creation Wu, Jingjing @ 2017-05-01 13:18 ` Thomas Monjalon 0 siblings, 0 replies; 5+ messages in thread From: Thomas Monjalon @ 2017-05-01 13:18 UTC (permalink / raw) To: Olivier Matz; +Cc: stable, Wu, Jingjing, dev, Richardson, Bruce 28/04/2017 10:51, Wu, Jingjing: > From: Olivier Matz [mailto:olivier.matz@6wind.com] > > Since > > commit 999b2ee0fe45 ("app/testpmd: enable NUMA support by default"), > > testpmd is started with numa enabled by default. This highlights a floating point > > exception when started with --total-num-mbufs without any port (division by 0). > > This bug was already triggered before this commit if the --no-numa option was > > given. > > > > This commit adds a check of the nb_ports value before doing the division. By > > looking at this code, it appears that the creation of the mbuf pool is not > > consistent for the number of mbufs depending on the configuration. This is fixed > > in the next commit. > > > > Fixes: b6ea6408fbc7 ("ethdev: store numa_node per device") > > > > CC: stable@dpdk.org > > Signed-off-by: Olivier Matz <olivier.matz@6wind.com> > > Acked-by: Jingjing Wu <jingjing.wu@intel.com> Series applied, thanks ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-05-01 13:18 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-04-24 12:33 [dpdk-dev] [PATCH 1/2] app/testpmd: fix crash at mbuf pool creation Olivier Matz 2017-04-24 12:33 ` [dpdk-dev] [PATCH 2/2] app/testpmd: fix number of mbufs in pool Olivier Matz 2017-04-28 9:04 ` Wu, Jingjing 2017-04-28 8:51 ` [dpdk-dev] [PATCH 1/2] app/testpmd: fix crash at mbuf pool creation Wu, Jingjing 2017-05-01 13:18 ` [dpdk-dev] [dpdk-stable] " 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).