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 21F6345EDD; Wed, 18 Dec 2024 16:21:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0546D40DF5; Wed, 18 Dec 2024 16:21:40 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 4C55940DDE for ; Wed, 18 Dec 2024 16:21:38 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 451B8203FC69; Wed, 18 Dec 2024 07:21:37 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 451B8203FC69 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1734535297; bh=uhw3gb5o5T6FTW8LBWnLU+Ehf24Zx93KOds4dRTJJm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gvoP58lOwDUi8K/sYifmNkJE/TMCwiLx5IMYlmLWy0uErs/0TE7FaM8osW26Hh4X4 ZENO/zIiUm1lLabqSBfIstfVV1Xyp8l3mcbgkFsoeA6cNnrS97ERWGYoiDu7uBZBBT EH+0iTdn1iaqH0aDxCswy+LJ7BTvf8Iufj/OtzOE= From: Andre Muezerie To: andremue@linux.microsoft.com Cc: stephen@networkplumber.org, bruce.richardson@intel.com, dev@dpdk.org, vladimir.medvedkin@intel.com Subject: [PATCH v3] app/test: fix stack overflow in lpm6_perf_autotest Date: Wed, 18 Dec 2024 07:21:26 -0800 Message-Id: <1734535286-27267-1-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1734057571-20367-1-git-send-email-andremue@linux.microsoft.com> References: <1734057571-20367-1-git-send-email-andremue@linux.microsoft.com> 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 Test lpm6_perf_autotest was hitting a stack overflow on Windows with both MSVC and Clang. The fix is to move some of the data from the stack to the heap. Signed-off-by: Andre Muezerie --- app/test/test_lpm6_perf.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/test/test_lpm6_perf.c b/app/test/test_lpm6_perf.c index 1860a99ed6..59df0a958a 100644 --- a/app/test/test_lpm6_perf.c +++ b/app/test/test_lpm6_perf.c @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -117,8 +118,13 @@ test_lpm6_perf(void) total_time = 0; count = 0; - struct rte_ipv6_addr ip_batch[NUM_IPS_ENTRIES]; - int32_t next_hops[NUM_IPS_ENTRIES]; + struct rte_ipv6_addr *ip_batch = rte_calloc("ip_batch", + NUM_IPS_ENTRIES, sizeof(struct rte_ipv6_addr), 0); + TEST_LPM_ASSERT(ip_batch != NULL); + + int32_t *next_hops = rte_calloc("next_hops", + NUM_IPS_ENTRIES, sizeof(int32_t), 0); + TEST_LPM_ASSERT(next_hops != NULL); for (i = 0; i < NUM_IPS_ENTRIES; i++) ip_batch[i] = large_ips_table[i].ip; @@ -153,6 +159,9 @@ test_lpm6_perf(void) printf("Average LPM Delete: %g cycles\n", (double)total_time / NUM_ROUTE_ENTRIES); + rte_free(next_hops); + rte_free(ip_batch); + rte_lpm6_delete_all(lpm); rte_lpm6_free(lpm); -- 2.47.0.vfs.0.3