From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 564B3A0C4B; Fri, 20 Aug 2021 10:13:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C570F41139; Fri, 20 Aug 2021 10:13:17 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id D1DB94013F; Fri, 20 Aug 2021 10:13:15 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 20DA61042; Fri, 20 Aug 2021 01:13:15 -0700 (PDT) Received: from net-arm-n1sdp.shanghai.arm.com (net-arm-n1sdp.shanghai.arm.com [10.169.208.222]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EAE7E3F66F; Fri, 20 Aug 2021 01:13:10 -0700 (PDT) From: Joyce Kong To: david.marchand@redhat.com, anatoly.burakov@intel.com, olivier.matz@6wind.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@arm.com, ruifeng.wang@arm.com Cc: dev@dpdk.org, nd@arm.com, stable@dpdk.org Date: Fri, 20 Aug 2021 03:12:59 -0500 Message-Id: <20210820081259.16161-1-joyce.kong@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210728073322.27011-1-joyce.kong@arm.com> References: <20210728073322.27011-1-joyce.kong@arm.com> Subject: [dpdk-dev] [PATCH v3] test/func_reentrancy: free memzones after creating test X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Reviewed-by: Ruifeng Wang Reviewed-by: Feifei Wang --- app/test/test_func_reentrancy.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentrancy.c index 231c99a9eb..f53268ac08 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); @@ -441,19 +460,21 @@ launch_test(struct test_case *pt_case) if (pt_case->func(pt_case->arg) < 0) ret = -1; + rte_eal_mp_wait_lcore(); cores = cores_save; RTE_LCORE_FOREACH_WORKER(lcore_id) { if (cores == 1) break; cores--; - if (rte_eal_wait_lcore(lcore_id) < 0) - ret = -1; if (pt_case->clean != NULL) 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", -- 2.17.1