patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 19.11] test/func_reentrancy: free memzones after test
@ 2021-12-01  8:13 Joyce Kong
  2021-12-01 10:31 ` Christian Ehrhardt
  0 siblings, 1 reply; 2+ messages in thread
From: Joyce Kong @ 2021-12-01  8:13 UTC (permalink / raw)
  To: stable
  Cc: christian.ehrhardt, nd, Joyce Kong, Ruifeng Wang, Feifei Wang,
	Olivier Matz, David Marchand

[ upstream commit d5559ac589953fa9f018aa581032e0f74bd49729 ]

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.

Meanwhile, add the missing free for test case on main thread.

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>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: David Marchand <david.marchand@redhat.com>
---
 app/test/test_func_reentrancy.c | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentrancy.c
index 4767c0cfa..969c6eb0f 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);
 
@@ -420,8 +439,7 @@ launch_test(struct test_case *pt_case)
 {
 	int ret = 0;
 	unsigned lcore_id;
-	unsigned cores_save = rte_lcore_count();
-	unsigned cores = RTE_MIN(cores_save, MAX_LCORES);
+	unsigned cores = RTE_MIN(rte_lcore_count(), MAX_LCORES);
 	unsigned count;
 
 	if (pt_case->func == NULL)
@@ -442,14 +460,12 @@ launch_test(struct test_case *pt_case)
 	if (pt_case->func(pt_case->arg) < 0)
 		ret = -1;
 
-	cores = cores_save;
 	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
-		if (cores == 1)
-			break;
-		cores--;
 		if (rte_eal_wait_lcore(lcore_id) < 0)
 			ret = -1;
+	}
 
+	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
 		if (pt_case->clean != NULL)
 			pt_case->clean(lcore_id);
 	}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 19.11] test/func_reentrancy: free memzones after test
  2021-12-01  8:13 [PATCH 19.11] test/func_reentrancy: free memzones after test Joyce Kong
@ 2021-12-01 10:31 ` Christian Ehrhardt
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Ehrhardt @ 2021-12-01 10:31 UTC (permalink / raw)
  To: Joyce Kong
  Cc: stable, nd, Ruifeng Wang, Feifei Wang, Olivier Matz, David Marchand

On Wed, Dec 1, 2021 at 9:13 AM Joyce Kong <joyce.kong@arm.com> wrote:
>
> [ upstream commit d5559ac589953fa9f018aa581032e0f74bd49729 ]
>

Thanks, applied

> 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.
>
> Meanwhile, add the missing free for test case on main thread.
>
> 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>
> Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
> Acked-by: David Marchand <david.marchand@redhat.com>
> ---
>  app/test/test_func_reentrancy.c | 30 +++++++++++++++++++++++-------
>  1 file changed, 23 insertions(+), 7 deletions(-)
>
> diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentrancy.c
> index 4767c0cfa..969c6eb0f 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);
>
> @@ -420,8 +439,7 @@ launch_test(struct test_case *pt_case)
>  {
>         int ret = 0;
>         unsigned lcore_id;
> -       unsigned cores_save = rte_lcore_count();
> -       unsigned cores = RTE_MIN(cores_save, MAX_LCORES);
> +       unsigned cores = RTE_MIN(rte_lcore_count(), MAX_LCORES);
>         unsigned count;
>
>         if (pt_case->func == NULL)
> @@ -442,14 +460,12 @@ launch_test(struct test_case *pt_case)
>         if (pt_case->func(pt_case->arg) < 0)
>                 ret = -1;
>
> -       cores = cores_save;
>         RTE_LCORE_FOREACH_SLAVE(lcore_id) {
> -               if (cores == 1)
> -                       break;
> -               cores--;
>                 if (rte_eal_wait_lcore(lcore_id) < 0)
>                         ret = -1;
> +       }
>
> +       RTE_LCORE_FOREACH_SLAVE(lcore_id) {
>                 if (pt_case->clean != NULL)
>                         pt_case->clean(lcore_id);
>         }
> --
> 2.25.1
>


-- 
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-01 10:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-01  8:13 [PATCH 19.11] test/func_reentrancy: free memzones after test Joyce Kong
2021-12-01 10:31 ` Christian Ehrhardt

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).