DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andre Muezerie <andremue@linux.microsoft.com>
To: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Cc: dev@dpdk.org, Andre Muezerie <andremue@linux.microsoft.com>
Subject: [PATCH] app/test: fix stack overflow in fib6_perf_autotest
Date: Mon, 23 Dec 2024 13:10:33 -0800	[thread overview]
Message-ID: <1734988233-20208-1-git-send-email-andremue@linux.microsoft.com> (raw)

Test fib6_perf_autotest was hitting a stack overflow on Windows
with MSVC.

The fix is to move some of the data from the stack to the heap.

Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
 app/test/test_fib6_perf.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/app/test/test_fib6_perf.c b/app/test/test_fib6_perf.c
index a96a0d6b2c..246bc2d509 100644
--- a/app/test/test_fib6_perf.c
+++ b/app/test/test_fib6_perf.c
@@ -9,6 +9,7 @@
 
 #include <rte_cycles.h>
 #include <rte_random.h>
+#include <rte_malloc.h>
 #include <rte_memory.h>
 #include <rte_fib6.h>
 
@@ -73,8 +74,14 @@ test_fib6_perf(void)
 	uint64_t next_hop_add;
 	int status = 0;
 	int64_t count = 0;
-	struct rte_ipv6_addr ip_batch[NUM_IPS_ENTRIES];
-	uint64_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_FIB_ASSERT(ip_batch != NULL);
+
+	uint64_t *next_hops = rte_calloc("next_hops",
+			NUM_IPS_ENTRIES, sizeof(uint64_t), 0);
+	TEST_FIB_ASSERT(next_hops != NULL);
 
 	conf.type = RTE_FIB6_TRIE;
 	conf.default_nh = 0;
@@ -151,6 +158,9 @@ test_fib6_perf(void)
 
 	rte_fib6_free(fib);
 
+	rte_free(next_hops);
+	rte_free(ip_batch);
+
 	return 0;
 }
 
-- 
2.47.0.vfs.0.3


             reply	other threads:[~2024-12-23 21:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-23 21:10 Andre Muezerie [this message]
2024-12-23 21:30 ` Stephen Hemminger
2024-12-24  1:47   ` Andre Muezerie
2024-12-24 11:06     ` Medvedkin, Vladimir

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1734988233-20208-1-git-send-email-andremue@linux.microsoft.com \
    --to=andremue@linux.microsoft.com \
    --cc=dev@dpdk.org \
    --cc=vladimir.medvedkin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).