diff mbox series

[v1] test/func_reentrancy: free memzones after creating test case

Message ID 20210728073322.27011-1-joyce.kong@arm.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers show
Series [v1] test/func_reentrancy: free memzones after creating test case | expand

Checks

Context Check Description
ci/iol-testing fail Testing issues
ci/iol-abi-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/github-robot success github build: passed
ci/iol-intel-Functional success Functional Testing PASS
ci/checkpatch success coding style OK

Commit Message

Joyce Kong July 28, 2021, 7:33 a.m. UTC
Function reentrancy test limits maximum number of iterations
simultaneously, however it doesn't free the 'fr_test_once'
memzones after the fact, so introduce freeing 'fr_test_once'
in ring/mempool/hash/fbk/lpm_clean.

Fixes: 104a92bd026f ("app: add reentrancy tests")
Fixes: 995eec619024 ("test: clean up memory for function reentrancy test")
Cc: stable@dpdk.org

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
---
 app/test/test_func_reentrancy.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

Comments

Olivier Matz July 30, 2021, 11:27 a.m. UTC | #1
Hi Joyce,

On Wed, Jul 28, 2021 at 02:33:22AM -0500, Joyce Kong wrote:
> Function reentrancy test limits maximum number of iterations
> simultaneously, however it doesn't free the 'fr_test_once'
> memzones after the fact, so introduce freeing 'fr_test_once'
> in ring/mempool/hash/fbk/lpm_clean.
> 
> Fixes: 104a92bd026f ("app: add reentrancy tests")
> Fixes: 995eec619024 ("test: clean up memory for function reentrancy test")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
> ---
>  app/test/test_func_reentrancy.c | 24 +++++++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentrancy.c
> index 231c99a9eb..e4e9c2cc7c 100644
> --- a/app/test/test_func_reentrancy.c
> +++ b/app/test/test_func_reentrancy.c
> @@ -89,6 +89,10 @@ ring_clean(unsigned int lcore_id)
>  	char ring_name[MAX_STRING_SIZE];
>  	int i;
>  
> +	rp = rte_ring_lookup("fr_test_once");
> +	if (rp != NULL)
> +		rte_ring_free(rp);
> +
>  	for (i = 0; i < MAX_ITER_MULTI; i++) {
>  		snprintf(ring_name, sizeof(ring_name),
>  				"fr_test_%d_%d", lcore_id, i);
> @@ -148,7 +152,10 @@ mempool_clean(unsigned int lcore_id)
>  	char mempool_name[MAX_STRING_SIZE];
>  	int i;
>  
> -	/* verify all ring created successful */
> +	mp = rte_mempool_lookup("fr_test_once");
> +	if (mp != NULL)
> +		rte_mempool_free(mp);
> +
>  	for (i = 0; i < MAX_ITER_MULTI; i++) {
>  		snprintf(mempool_name, sizeof(mempool_name), "fr_test_%d_%d",
>  			 lcore_id, i);
> @@ -208,6 +215,10 @@ hash_clean(unsigned lcore_id)
>  	struct rte_hash *handle;
>  	int i;
>  
> +	handle = rte_hash_find_existing("fr_test_once");
> +	if (handle != NULL)
> +		rte_hash_free(handle);
> +
>  	for (i = 0; i < MAX_ITER_MULTI; i++) {
>  		snprintf(hash_name, sizeof(hash_name), "fr_test_%d_%d",  lcore_id, i);
>  
> @@ -272,6 +283,10 @@ fbk_clean(unsigned lcore_id)
>  	struct rte_fbk_hash_table *handle;
>  	int i;
>  
> +	handle = rte_fbk_hash_find_existing("fr_test_once");
> +	if (handle != NULL)
> +		rte_fbk_hash_free(handle);
> +
>  	for (i = 0; i < MAX_ITER_MULTI; i++) {
>  		snprintf(fbk_name, sizeof(fbk_name), "fr_test_%d_%d",  lcore_id, i);
>  
> @@ -338,6 +353,10 @@ lpm_clean(unsigned int lcore_id)
>  	struct rte_lpm *lpm;
>  	int i;
>  
> +	lpm = rte_lpm_find_existing("fr_test_once");
> +	if (lpm != NULL)
> +		rte_lpm_free(lpm);
> +
>  	for (i = 0; i < MAX_LPM_ITER_TIMES; i++) {
>  		snprintf(lpm_name, sizeof(lpm_name), "fr_test_%d_%d",  lcore_id, i);
>  
> @@ -454,6 +473,9 @@ launch_test(struct test_case *pt_case)
>  			pt_case->clean(lcore_id);
>  	}
>  
> +	if (pt_case->clean != NULL)
> +		pt_case->clean(rte_get_main_lcore());
> +

Is it the same issue? It looks it adds the missing frees for the main thread
(not only "fr_test_once"). I don't think it requires another patch, but a word
could be added about it in the commit log.


>  	count = rte_atomic32_read(&obj_count);
>  	if (count != 1) {
>  		printf("%s: common object allocated %d times (should be 1)\n",
> -- 
> 2.17.1
>
Joyce Kong July 31, 2021, 8:42 a.m. UTC | #2
> -----Original Message-----
> From: Olivier Matz <olivier.matz@6wind.com>
> Sent: Friday, July 30, 2021 7:27 PM
> To: Joyce Kong <Joyce.Kong@arm.com>
> Cc: anatoly.burakov@intel.com; andrew.rybchenko@oktetlabs.ru;
> yipeng1.wang@intel.com; sameh.gobriel@intel.com;
> bruce.richardson@intel.com; vladimir.medvedkin@intel.com;
> konstantin.ananyev@intel.com; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>; Ruifeng Wang
> <Ruifeng.Wang@arm.com>; dev@dpdk.org; nd <nd@arm.com>;
> stable@dpdk.org
> Subject: Re: [PATCH v1] test/func_reentrancy: free memzones after creating
> test case
> 
> Hi Joyce,
> 
> On Wed, Jul 28, 2021 at 02:33:22AM -0500, Joyce Kong wrote:
> > Function reentrancy test limits maximum number of iterations
> > simultaneously, however it doesn't free the 'fr_test_once'
> > memzones after the fact, so introduce freeing 'fr_test_once'
> > in ring/mempool/hash/fbk/lpm_clean.
> >
> > Fixes: 104a92bd026f ("app: add reentrancy tests")
> > Fixes: 995eec619024 ("test: clean up memory for function reentrancy
> > test")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
> > ---
> >  app/test/test_func_reentrancy.c | 24 +++++++++++++++++++++++-
> >  1 file changed, 23 insertions(+), 1 deletion(-)
> >
> > diff --git a/app/test/test_func_reentrancy.c
> > b/app/test/test_func_reentrancy.c index 231c99a9eb..e4e9c2cc7c 100644
> > --- a/app/test/test_func_reentrancy.c
> > +++ b/app/test/test_func_reentrancy.c
> > @@ -89,6 +89,10 @@ ring_clean(unsigned int lcore_id)
> >  	char ring_name[MAX_STRING_SIZE];
> >  	int i;
> >
> > +	rp = rte_ring_lookup("fr_test_once");
> > +	if (rp != NULL)
> > +		rte_ring_free(rp);
> > +
> >  	for (i = 0; i < MAX_ITER_MULTI; i++) {
> >  		snprintf(ring_name, sizeof(ring_name),
> >  				"fr_test_%d_%d", lcore_id, i);
> > @@ -148,7 +152,10 @@ mempool_clean(unsigned int lcore_id)
> >  	char mempool_name[MAX_STRING_SIZE];
> >  	int i;
> >
> > -	/* verify all ring created successful */
> > +	mp = rte_mempool_lookup("fr_test_once");
> > +	if (mp != NULL)
> > +		rte_mempool_free(mp);
> > +
> >  	for (i = 0; i < MAX_ITER_MULTI; i++) {
> >  		snprintf(mempool_name, sizeof(mempool_name),
> "fr_test_%d_%d",
> >  			 lcore_id, i);
> > @@ -208,6 +215,10 @@ hash_clean(unsigned lcore_id)
> >  	struct rte_hash *handle;
> >  	int i;
> >
> > +	handle = rte_hash_find_existing("fr_test_once");
> > +	if (handle != NULL)
> > +		rte_hash_free(handle);
> > +
> >  	for (i = 0; i < MAX_ITER_MULTI; i++) {
> >  		snprintf(hash_name, sizeof(hash_name), "fr_test_%d_%d",
> lcore_id,
> > i);
> >
> > @@ -272,6 +283,10 @@ fbk_clean(unsigned lcore_id)
> >  	struct rte_fbk_hash_table *handle;
> >  	int i;
> >
> > +	handle = rte_fbk_hash_find_existing("fr_test_once");
> > +	if (handle != NULL)
> > +		rte_fbk_hash_free(handle);
> > +
> >  	for (i = 0; i < MAX_ITER_MULTI; i++) {
> >  		snprintf(fbk_name, sizeof(fbk_name), "fr_test_%d_%d",
> lcore_id,
> > i);
> >
> > @@ -338,6 +353,10 @@ lpm_clean(unsigned int lcore_id)
> >  	struct rte_lpm *lpm;
> >  	int i;
> >
> > +	lpm = rte_lpm_find_existing("fr_test_once");
> > +	if (lpm != NULL)
> > +		rte_lpm_free(lpm);
> > +
> >  	for (i = 0; i < MAX_LPM_ITER_TIMES; i++) {
> >  		snprintf(lpm_name, sizeof(lpm_name), "fr_test_%d_%d",
> lcore_id,
> > i);
> >
> > @@ -454,6 +473,9 @@ launch_test(struct test_case *pt_case)
> >  			pt_case->clean(lcore_id);
> >  	}
> >
> > +	if (pt_case->clean != NULL)
> > +		pt_case->clean(rte_get_main_lcore());
> > +
> 
> Is it the same issue? It looks it adds the missing frees for the main thread (not
> only "fr_test_once"). I don't think it requires another patch, but a word could
> be added about it in the commit log.
> 
Thanks, Olivier, will send another version to add this in the commit log.

> 
> >  	count = rte_atomic32_read(&obj_count);
> >  	if (count != 1) {
> >  		printf("%s: common object allocated %d times (should be
> 1)\n",
> > --
> > 2.17.1
> >
diff mbox series

Patch

diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentrancy.c
index 231c99a9eb..e4e9c2cc7c 100644
--- a/app/test/test_func_reentrancy.c
+++ b/app/test/test_func_reentrancy.c
@@ -89,6 +89,10 @@  ring_clean(unsigned int lcore_id)
 	char ring_name[MAX_STRING_SIZE];
 	int i;
 
+	rp = rte_ring_lookup("fr_test_once");
+	if (rp != NULL)
+		rte_ring_free(rp);
+
 	for (i = 0; i < MAX_ITER_MULTI; i++) {
 		snprintf(ring_name, sizeof(ring_name),
 				"fr_test_%d_%d", lcore_id, i);
@@ -148,7 +152,10 @@  mempool_clean(unsigned int lcore_id)
 	char mempool_name[MAX_STRING_SIZE];
 	int i;
 
-	/* verify all ring created successful */
+	mp = rte_mempool_lookup("fr_test_once");
+	if (mp != NULL)
+		rte_mempool_free(mp);
+
 	for (i = 0; i < MAX_ITER_MULTI; i++) {
 		snprintf(mempool_name, sizeof(mempool_name), "fr_test_%d_%d",
 			 lcore_id, i);
@@ -208,6 +215,10 @@  hash_clean(unsigned lcore_id)
 	struct rte_hash *handle;
 	int i;
 
+	handle = rte_hash_find_existing("fr_test_once");
+	if (handle != NULL)
+		rte_hash_free(handle);
+
 	for (i = 0; i < MAX_ITER_MULTI; i++) {
 		snprintf(hash_name, sizeof(hash_name), "fr_test_%d_%d",  lcore_id, i);
 
@@ -272,6 +283,10 @@  fbk_clean(unsigned lcore_id)
 	struct rte_fbk_hash_table *handle;
 	int i;
 
+	handle = rte_fbk_hash_find_existing("fr_test_once");
+	if (handle != NULL)
+		rte_fbk_hash_free(handle);
+
 	for (i = 0; i < MAX_ITER_MULTI; i++) {
 		snprintf(fbk_name, sizeof(fbk_name), "fr_test_%d_%d",  lcore_id, i);
 
@@ -338,6 +353,10 @@  lpm_clean(unsigned int lcore_id)
 	struct rte_lpm *lpm;
 	int i;
 
+	lpm = rte_lpm_find_existing("fr_test_once");
+	if (lpm != NULL)
+		rte_lpm_free(lpm);
+
 	for (i = 0; i < MAX_LPM_ITER_TIMES; i++) {
 		snprintf(lpm_name, sizeof(lpm_name), "fr_test_%d_%d",  lcore_id, i);
 
@@ -454,6 +473,9 @@  launch_test(struct test_case *pt_case)
 			pt_case->clean(lcore_id);
 	}
 
+	if (pt_case->clean != NULL)
+		pt_case->clean(rte_get_main_lcore());
+
 	count = rte_atomic32_read(&obj_count);
 	if (count != 1) {
 		printf("%s: common object allocated %d times (should be 1)\n",