* [dpdk-stable] [PATCH 1/3] app/testpmd: fix mempool free on exit [not found] <cover.1554114165.git.shahafs@mellanox.com> @ 2019-04-01 10:34 ` Shahaf Shuler [not found] ` <cover.1554354506.git.shahafs@mellanox.com> 1 sibling, 0 replies; 7+ messages in thread From: Shahaf Shuler @ 2019-04-01 10:34 UTC (permalink / raw) To: wenzhuo.lu, jingjing.wu, bernard.iremonger Cc: dev, rasland, thomas, ferruh.yigit, stable Allocated mempools were never free. it is bad practice. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/testpmd.c | 24 ++++++++++++++++++------ app/test-pmd/testpmd.h | 2 ++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 40c873b972..7ea6c1d7e0 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -188,6 +188,8 @@ struct fwd_engine * fwd_engines[] = { NULL, }; +struct rte_mempool *mempools[RTE_MAX_NUMA_NODES]; + struct fwd_config cur_fwd_config; struct fwd_engine *cur_fwd_eng = &io_fwd_engine; /**< IO mode by default. */ uint32_t retry_enabled; @@ -835,7 +837,7 @@ setup_extmem(uint32_t nb_mbufs, uint32_t mbuf_sz, bool huge) /* * Configuration initialisation done once at init time. */ -static void +static struct rte_mempool * mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, unsigned int socket_id) { @@ -904,6 +906,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, rte_exit(EXIT_FAILURE, "Invalid mempool creation mode\n"); } } + return rte_mp; err: if (rte_mp == NULL) { @@ -913,6 +916,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, } else if (verbose_level > 0) { rte_mempool_dump(stdout, rte_mp); } + return NULL; } /* @@ -1130,14 +1134,18 @@ init_config(void) uint8_t i; for (i = 0; i < num_sockets; i++) - mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, - socket_ids[i]); + mempools[i] = mbuf_pool_create(mbuf_data_size, + nb_mbuf_per_pool, + socket_ids[i]); } else { if (socket_num == UMA_NO_CONFIG) - mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, 0); + mempools[0] = mbuf_pool_create(mbuf_data_size, + nb_mbuf_per_pool, 0); else - mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, - socket_num); + mempools[socket_num] = mbuf_pool_create + (mbuf_data_size, + nb_mbuf_per_pool, + socket_num); } init_port_config(); @@ -2396,6 +2404,7 @@ pmd_test_exit(void) struct rte_device *device; portid_t pt_id; int ret; + int i; if (test_done == 0) stop_packet_forwarding(); @@ -2449,6 +2458,9 @@ pmd_test_exit(void) return; } } + for (i = 0 ; i < RTE_MAX_NUMA_NODES ; i++) + if (mempools[i]) + rte_mempool_free(mempools[i]); printf("\nBye...\n"); } diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index a45988ebc5..84ce8ffa2f 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -264,6 +264,8 @@ extern struct fwd_engine ieee1588_fwd_engine; extern struct fwd_engine * fwd_engines[]; /**< NULL terminated array. */ +extern struct rte_mempool *mempools[RTE_MAX_NUMA_NODES]; + /** * Forwarding Configuration * -- 2.12.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <cover.1554354506.git.shahafs@mellanox.com>]
* [dpdk-stable] [PATCH v2 1/3] app/testpmd: fix mempool free on exit [not found] ` <cover.1554354506.git.shahafs@mellanox.com> @ 2019-04-04 5:14 ` Shahaf Shuler 2019-04-08 13:39 ` Iremonger, Bernard [not found] ` <cover.1554406293.git.shahafs@mellanox.com> 1 sibling, 1 reply; 7+ messages in thread From: Shahaf Shuler @ 2019-04-04 5:14 UTC (permalink / raw) To: wenzhuo.lu, jingjing.wu, bernard.iremonger Cc: dev, rasland, thomas, ferruh.yigit, stable Allocated mempools were never free. it is bad practice. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/testpmd.c | 25 +++++++++++++++++++------ app/test-pmd/testpmd.h | 2 ++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 40c873b972..5c68eb9ec6 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -188,6 +188,8 @@ struct fwd_engine * fwd_engines[] = { NULL, }; +struct rte_mempool *mempools[RTE_MAX_NUMA_NODES]; + struct fwd_config cur_fwd_config; struct fwd_engine *cur_fwd_eng = &io_fwd_engine; /**< IO mode by default. */ uint32_t retry_enabled; @@ -835,7 +837,7 @@ setup_extmem(uint32_t nb_mbufs, uint32_t mbuf_sz, bool huge) /* * Configuration initialisation done once at init time. */ -static void +static struct rte_mempool * mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, unsigned int socket_id) { @@ -904,6 +906,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, rte_exit(EXIT_FAILURE, "Invalid mempool creation mode\n"); } } + return rte_mp; err: if (rte_mp == NULL) { @@ -913,6 +916,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, } else if (verbose_level > 0) { rte_mempool_dump(stdout, rte_mp); } + return NULL; } /* @@ -1130,14 +1134,18 @@ init_config(void) uint8_t i; for (i = 0; i < num_sockets; i++) - mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, - socket_ids[i]); + mempools[i] = mbuf_pool_create(mbuf_data_size, + nb_mbuf_per_pool, + socket_ids[i]); } else { if (socket_num == UMA_NO_CONFIG) - mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, 0); + mempools[0] = mbuf_pool_create(mbuf_data_size, + nb_mbuf_per_pool, 0); else - mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, - socket_num); + mempools[socket_num] = mbuf_pool_create + (mbuf_data_size, + nb_mbuf_per_pool, + socket_num); } init_port_config(); @@ -2396,6 +2404,7 @@ pmd_test_exit(void) struct rte_device *device; portid_t pt_id; int ret; + int i; if (test_done == 0) stop_packet_forwarding(); @@ -2449,6 +2458,10 @@ pmd_test_exit(void) return; } } + for (i = 0 ; i < RTE_MAX_NUMA_NODES ; i++) { + if (mempools[i]) + rte_mempool_free(mempools[i]); + } printf("\nBye...\n"); } diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index a45988ebc5..84ce8ffa2f 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -264,6 +264,8 @@ extern struct fwd_engine ieee1588_fwd_engine; extern struct fwd_engine * fwd_engines[]; /**< NULL terminated array. */ +extern struct rte_mempool *mempools[RTE_MAX_NUMA_NODES]; + /** * Forwarding Configuration * -- 2.12.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-stable] [PATCH v2 1/3] app/testpmd: fix mempool free on exit 2019-04-04 5:14 ` [dpdk-stable] [PATCH v2 " Shahaf Shuler @ 2019-04-08 13:39 ` Iremonger, Bernard 0 siblings, 0 replies; 7+ messages in thread From: Iremonger, Bernard @ 2019-04-08 13:39 UTC (permalink / raw) To: Shahaf Shuler, Lu, Wenzhuo, Wu, Jingjing Cc: dev, rasland, thomas, Yigit, Ferruh, stable > -----Original Message----- > From: Shahaf Shuler [mailto:shahafs@mellanox.com] > Sent: Thursday, April 4, 2019 6:15 AM > To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing > <jingjing.wu@intel.com>; Iremonger, Bernard <bernard.iremonger@intel.com> > Cc: dev@dpdk.org; rasland@mellanox.com; thomas@monjalon.net; Yigit, > Ferruh <ferruh.yigit@intel.com>; stable@dpdk.org > Subject: [PATCH v2 1/3] app/testpmd: fix mempool free on exit > > Allocated mempools were never free. it is bad practice. > > Fixes: af75078fece3 ("first public release") > Cc: stable@dpdk.org > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Bernard Iremonger <bernard.iremonger@intel.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <cover.1554406293.git.shahafs@mellanox.com>]
* [dpdk-stable] [PATCH v3 1/3] app/testpmd: fix mempool free on exit [not found] ` <cover.1554406293.git.shahafs@mellanox.com> @ 2019-04-04 19:34 ` Shahaf Shuler 2019-04-05 14:41 ` Ferruh Yigit [not found] ` <cover.1554613242.git.shahafs@mellanox.com> 1 sibling, 1 reply; 7+ messages in thread From: Shahaf Shuler @ 2019-04-04 19:34 UTC (permalink / raw) To: wenzhuo.lu, jingjing.wu, bernard.iremonger Cc: dev, rasland, thomas, ferruh.yigit, stable Allocated mempools were never free. it is bad practice. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/testpmd.c | 25 +++++++++++++++++++------ app/test-pmd/testpmd.h | 2 ++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 40c873b972..5c68eb9ec6 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -188,6 +188,8 @@ struct fwd_engine * fwd_engines[] = { NULL, }; +struct rte_mempool *mempools[RTE_MAX_NUMA_NODES]; + struct fwd_config cur_fwd_config; struct fwd_engine *cur_fwd_eng = &io_fwd_engine; /**< IO mode by default. */ uint32_t retry_enabled; @@ -835,7 +837,7 @@ setup_extmem(uint32_t nb_mbufs, uint32_t mbuf_sz, bool huge) /* * Configuration initialisation done once at init time. */ -static void +static struct rte_mempool * mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, unsigned int socket_id) { @@ -904,6 +906,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, rte_exit(EXIT_FAILURE, "Invalid mempool creation mode\n"); } } + return rte_mp; err: if (rte_mp == NULL) { @@ -913,6 +916,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, } else if (verbose_level > 0) { rte_mempool_dump(stdout, rte_mp); } + return NULL; } /* @@ -1130,14 +1134,18 @@ init_config(void) uint8_t i; for (i = 0; i < num_sockets; i++) - mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, - socket_ids[i]); + mempools[i] = mbuf_pool_create(mbuf_data_size, + nb_mbuf_per_pool, + socket_ids[i]); } else { if (socket_num == UMA_NO_CONFIG) - mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, 0); + mempools[0] = mbuf_pool_create(mbuf_data_size, + nb_mbuf_per_pool, 0); else - mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, - socket_num); + mempools[socket_num] = mbuf_pool_create + (mbuf_data_size, + nb_mbuf_per_pool, + socket_num); } init_port_config(); @@ -2396,6 +2404,7 @@ pmd_test_exit(void) struct rte_device *device; portid_t pt_id; int ret; + int i; if (test_done == 0) stop_packet_forwarding(); @@ -2449,6 +2458,10 @@ pmd_test_exit(void) return; } } + for (i = 0 ; i < RTE_MAX_NUMA_NODES ; i++) { + if (mempools[i]) + rte_mempool_free(mempools[i]); + } printf("\nBye...\n"); } diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index a45988ebc5..84ce8ffa2f 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -264,6 +264,8 @@ extern struct fwd_engine ieee1588_fwd_engine; extern struct fwd_engine * fwd_engines[]; /**< NULL terminated array. */ +extern struct rte_mempool *mempools[RTE_MAX_NUMA_NODES]; + /** * Forwarding Configuration * -- 2.12.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-stable] [PATCH v3 1/3] app/testpmd: fix mempool free on exit 2019-04-04 19:34 ` [dpdk-stable] [PATCH v3 " Shahaf Shuler @ 2019-04-05 14:41 ` Ferruh Yigit 0 siblings, 0 replies; 7+ messages in thread From: Ferruh Yigit @ 2019-04-05 14:41 UTC (permalink / raw) To: Shahaf Shuler, wenzhuo.lu, jingjing.wu, bernard.iremonger Cc: dev, rasland, thomas, stable On 4/4/2019 8:34 PM, Shahaf Shuler wrote: > Allocated mempools were never free. it is bad practice. +1 > > Fixes: af75078fece3 ("first public release") > Cc: stable@dpdk.org > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> <...> > @@ -835,7 +837,7 @@ setup_extmem(uint32_t nb_mbufs, uint32_t mbuf_sz, bool huge) > /* > * Configuration initialisation done once at init time. > */ > -static void > +static struct rte_mempool * > mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, > unsigned int socket_id) > { > @@ -904,6 +906,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, > rte_exit(EXIT_FAILURE, "Invalid mempool creation mode\n"); > } > } > + return rte_mp; > > err: > if (rte_mp == NULL) { > @@ -913,6 +916,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, > } else if (verbose_level > 0) { > rte_mempool_dump(stdout, rte_mp); > } > + return NULL; This return never reached, because a few lines above there is: if (rte_mp == NULL) { rte_exit(EXIT_FAILURE ... And for above "return rte_mp;" case, it skips "if (verbose_level > 0)" checks because of an early return. So what do you think remove above "return rte_mp;", and move here, instead of NULL return? <...> > @@ -264,6 +264,8 @@ extern struct fwd_engine ieee1588_fwd_engine; > > extern struct fwd_engine * fwd_engines[]; /**< NULL terminated array. */ > > +extern struct rte_mempool *mempools[RTE_MAX_NUMA_NODES]; There is no other .c file using 'mempools', can drop the extern. ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <cover.1554613242.git.shahafs@mellanox.com>]
* [dpdk-stable] [PATCH v4 1/3] app/testpmd: fix mempool free on exit [not found] ` <cover.1554613242.git.shahafs@mellanox.com> @ 2019-04-07 5:02 ` Shahaf Shuler 2019-04-08 14:14 ` Iremonger, Bernard 0 siblings, 1 reply; 7+ messages in thread From: Shahaf Shuler @ 2019-04-07 5:02 UTC (permalink / raw) To: wenzhuo.lu, jingjing.wu, bernard.iremonger Cc: dev, rasland, thomas, ferruh.yigit, stable Allocated mempools were never free. it is bad practice. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/testpmd.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index aeaa74c989..b7f70b0c47 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -188,6 +188,8 @@ struct fwd_engine * fwd_engines[] = { NULL, }; +struct rte_mempool *mempools[RTE_MAX_NUMA_NODES]; + struct fwd_config cur_fwd_config; struct fwd_engine *cur_fwd_eng = &io_fwd_engine; /**< IO mode by default. */ uint32_t retry_enabled; @@ -835,7 +837,7 @@ setup_extmem(uint32_t nb_mbufs, uint32_t mbuf_sz, bool huge) /* * Configuration initialisation done once at init time. */ -static void +static struct rte_mempool * mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, unsigned int socket_id) { @@ -913,6 +915,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, } else if (verbose_level > 0) { rte_mempool_dump(stdout, rte_mp); } + return rte_mp; } /* @@ -1130,14 +1133,18 @@ init_config(void) uint8_t i; for (i = 0; i < num_sockets; i++) - mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, - socket_ids[i]); + mempools[i] = mbuf_pool_create(mbuf_data_size, + nb_mbuf_per_pool, + socket_ids[i]); } else { if (socket_num == UMA_NO_CONFIG) - mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, 0); + mempools[0] = mbuf_pool_create(mbuf_data_size, + nb_mbuf_per_pool, 0); else - mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, - socket_num); + mempools[socket_num] = mbuf_pool_create + (mbuf_data_size, + nb_mbuf_per_pool, + socket_num); } init_port_config(); @@ -2394,6 +2401,7 @@ pmd_test_exit(void) struct rte_device *device; portid_t pt_id; int ret; + int i; if (test_done == 0) stop_packet_forwarding(); @@ -2447,6 +2455,10 @@ pmd_test_exit(void) return; } } + for (i = 0 ; i < RTE_MAX_NUMA_NODES ; i++) { + if (mempools[i]) + rte_mempool_free(mempools[i]); + } printf("\nBye...\n"); } -- 2.12.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-stable] [PATCH v4 1/3] app/testpmd: fix mempool free on exit 2019-04-07 5:02 ` [dpdk-stable] [PATCH v4 " Shahaf Shuler @ 2019-04-08 14:14 ` Iremonger, Bernard 0 siblings, 0 replies; 7+ messages in thread From: Iremonger, Bernard @ 2019-04-08 14:14 UTC (permalink / raw) To: Shahaf Shuler, Lu, Wenzhuo, Wu, Jingjing Cc: dev, rasland, thomas, Yigit, Ferruh, stable > -----Original Message----- > From: Shahaf Shuler [mailto:shahafs@mellanox.com] > Sent: Sunday, April 7, 2019 6:02 AM > To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing > <jingjing.wu@intel.com>; Iremonger, Bernard <bernard.iremonger@intel.com> > Cc: dev@dpdk.org; rasland@mellanox.com; thomas@monjalon.net; Yigit, > Ferruh <ferruh.yigit@intel.com>; stable@dpdk.org > Subject: [PATCH v4 1/3] app/testpmd: fix mempool free on exit > > Allocated mempools were never free. it is bad practice. > > Fixes: af75078fece3 ("first public release") > Cc: stable@dpdk.org > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Bernard Iremonger <bernard.iremonger@intel.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-04-08 14:14 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <cover.1554114165.git.shahafs@mellanox.com> 2019-04-01 10:34 ` [dpdk-stable] [PATCH 1/3] app/testpmd: fix mempool free on exit Shahaf Shuler [not found] ` <cover.1554354506.git.shahafs@mellanox.com> 2019-04-04 5:14 ` [dpdk-stable] [PATCH v2 " Shahaf Shuler 2019-04-08 13:39 ` Iremonger, Bernard [not found] ` <cover.1554406293.git.shahafs@mellanox.com> 2019-04-04 19:34 ` [dpdk-stable] [PATCH v3 " Shahaf Shuler 2019-04-05 14:41 ` Ferruh Yigit [not found] ` <cover.1554613242.git.shahafs@mellanox.com> 2019-04-07 5:02 ` [dpdk-stable] [PATCH v4 " Shahaf Shuler 2019-04-08 14:14 ` Iremonger, Bernard
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).