* [PATCH] app/test: fix stack overflow in lpm6_perf_autotest @ 2024-12-13 2:39 Andre Muezerie 2024-12-13 10:22 ` Medvedkin, Vladimir ` (2 more replies) 0 siblings, 3 replies; 11+ messages in thread From: Andre Muezerie @ 2024-12-13 2:39 UTC (permalink / raw) To: Bruce Richardson, Vladimir Medvedkin; +Cc: dev, Andre Muezerie 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 <andremue@linux.microsoft.com> --- app/test/test_lpm6_perf.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/test/test_lpm6_perf.c b/app/test/test_lpm6_perf.c index 1860a99ed6..8231ad825d 100644 --- a/app/test/test_lpm6_perf.c +++ b/app/test/test_lpm6_perf.c @@ -117,8 +117,12 @@ 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 = (struct rte_ipv6_addr *)malloc( + sizeof(struct rte_ipv6_addr) * NUM_IPS_ENTRIES); + TEST_LPM_ASSERT(ip_batch != NULL); + + int32_t *next_hops = (int32_t *)malloc(sizeof(int32_t) * NUM_IPS_ENTRIES); + TEST_LPM_ASSERT(next_hops != NULL); for (i = 0; i < NUM_IPS_ENTRIES; i++) ip_batch[i] = large_ips_table[i].ip; @@ -153,6 +157,9 @@ test_lpm6_perf(void) printf("Average LPM Delete: %g cycles\n", (double)total_time / NUM_ROUTE_ENTRIES); + free(next_hops); + free(ip_batch); + rte_lpm6_delete_all(lpm); rte_lpm6_free(lpm); -- 2.47.0.vfs.0.3 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] app/test: fix stack overflow in lpm6_perf_autotest 2024-12-13 2:39 [PATCH] app/test: fix stack overflow in lpm6_perf_autotest Andre Muezerie @ 2024-12-13 10:22 ` Medvedkin, Vladimir 2024-12-13 17:05 ` Andre Muezerie 2024-12-13 17:08 ` Stephen Hemminger 2024-12-13 17:08 ` [PATCH v2] " Andre Muezerie 2024-12-18 15:21 ` [PATCH v3] " Andre Muezerie 2 siblings, 2 replies; 11+ messages in thread From: Medvedkin, Vladimir @ 2024-12-13 10:22 UTC (permalink / raw) To: Andre Muezerie, Bruce Richardson; +Cc: dev Hi Andre, On 13/12/2024 02:39, Andre Muezerie wrote: > 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 <andremue@linux.microsoft.com> > --- > app/test/test_lpm6_perf.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/app/test/test_lpm6_perf.c b/app/test/test_lpm6_perf.c > index 1860a99ed6..8231ad825d 100644 > --- a/app/test/test_lpm6_perf.c > +++ b/app/test/test_lpm6_perf.c > @@ -117,8 +117,12 @@ 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 = (struct rte_ipv6_addr *)malloc( why not rte_malloc? > + sizeof(struct rte_ipv6_addr) * NUM_IPS_ENTRIES); > + TEST_LPM_ASSERT(ip_batch != NULL); > + > + int32_t *next_hops = (int32_t *)malloc(sizeof(int32_t) * NUM_IPS_ENTRIES); > + TEST_LPM_ASSERT(next_hops != NULL); > > for (i = 0; i < NUM_IPS_ENTRIES; i++) > ip_batch[i] = large_ips_table[i].ip; > @@ -153,6 +157,9 @@ test_lpm6_perf(void) > printf("Average LPM Delete: %g cycles\n", > (double)total_time / NUM_ROUTE_ENTRIES); > > + free(next_hops); > + free(ip_batch); > + > rte_lpm6_delete_all(lpm); > rte_lpm6_free(lpm); > -- Regards, Vladimir ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] app/test: fix stack overflow in lpm6_perf_autotest 2024-12-13 10:22 ` Medvedkin, Vladimir @ 2024-12-13 17:05 ` Andre Muezerie 2024-12-13 17:08 ` Stephen Hemminger 1 sibling, 0 replies; 11+ messages in thread From: Andre Muezerie @ 2024-12-13 17:05 UTC (permalink / raw) To: Medvedkin, Vladimir; +Cc: Bruce Richardson, dev On Fri, Dec 13, 2024 at 10:22:20AM +0000, Medvedkin, Vladimir wrote: > Hi Andre, > > On 13/12/2024 02:39, Andre Muezerie wrote: > >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 <andremue@linux.microsoft.com> > >--- > > app/test/test_lpm6_perf.c | 11 +++++++++-- > > 1 file changed, 9 insertions(+), 2 deletions(-) > > > >diff --git a/app/test/test_lpm6_perf.c b/app/test/test_lpm6_perf.c > >index 1860a99ed6..8231ad825d 100644 > >--- a/app/test/test_lpm6_perf.c > >+++ b/app/test/test_lpm6_perf.c > >@@ -117,8 +117,12 @@ 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 = (struct rte_ipv6_addr *)malloc( > why not rte_malloc? For no good reason :-) I'll update the patch. Thanks for the suggestion. Andre Muezerie > >+ sizeof(struct rte_ipv6_addr) * NUM_IPS_ENTRIES); > >+ TEST_LPM_ASSERT(ip_batch != NULL); > >+ > >+ int32_t *next_hops = (int32_t *)malloc(sizeof(int32_t) * NUM_IPS_ENTRIES); > >+ TEST_LPM_ASSERT(next_hops != NULL); > > for (i = 0; i < NUM_IPS_ENTRIES; i++) > > ip_batch[i] = large_ips_table[i].ip; > >@@ -153,6 +157,9 @@ test_lpm6_perf(void) > > printf("Average LPM Delete: %g cycles\n", > > (double)total_time / NUM_ROUTE_ENTRIES); > >+ free(next_hops); > >+ free(ip_batch); > >+ > > rte_lpm6_delete_all(lpm); > > rte_lpm6_free(lpm); > > -- > Regards, > Vladimir ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] app/test: fix stack overflow in lpm6_perf_autotest 2024-12-13 10:22 ` Medvedkin, Vladimir 2024-12-13 17:05 ` Andre Muezerie @ 2024-12-13 17:08 ` Stephen Hemminger 1 sibling, 0 replies; 11+ messages in thread From: Stephen Hemminger @ 2024-12-13 17:08 UTC (permalink / raw) To: Medvedkin, Vladimir; +Cc: Andre Muezerie, Bruce Richardson, dev On Fri, 13 Dec 2024 10:22:20 +0000 "Medvedkin, Vladimir" <vladimir.medvedkin@intel.com> wrote: > Hi Andre, > > On 13/12/2024 02:39, Andre Muezerie wrote: > > 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 <andremue@linux.microsoft.com> > > --- > > app/test/test_lpm6_perf.c | 11 +++++++++-- > > 1 file changed, 9 insertions(+), 2 deletions(-) > > > > diff --git a/app/test/test_lpm6_perf.c b/app/test/test_lpm6_perf.c > > index 1860a99ed6..8231ad825d 100644 > > --- a/app/test/test_lpm6_perf.c > > +++ b/app/test/test_lpm6_perf.c > > @@ -117,8 +117,12 @@ 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 = (struct rte_ipv6_addr *)malloc( > why not rte_malloc? > > + sizeof(struct rte_ipv6_addr) * NUM_IPS_ENTRIES); > > + TEST_LPM_ASSERT(ip_batch != NULL); There is no need for rte_malloc() here. The data doesn't need to come from hugepages and regular malloc() has more checking. But the cast is unnecessary in C. ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2] app/test: fix stack overflow in lpm6_perf_autotest 2024-12-13 2:39 [PATCH] app/test: fix stack overflow in lpm6_perf_autotest Andre Muezerie 2024-12-13 10:22 ` Medvedkin, Vladimir @ 2024-12-13 17:08 ` Andre Muezerie 2024-12-13 17:15 ` Stephen Hemminger 2024-12-18 15:21 ` [PATCH v3] " Andre Muezerie 2 siblings, 1 reply; 11+ messages in thread From: Andre Muezerie @ 2024-12-13 17:08 UTC (permalink / raw) To: andremue; +Cc: bruce.richardson, dev, vladimir.medvedkin 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 <andremue@linux.microsoft.com> --- app/test/test_lpm6_perf.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/test/test_lpm6_perf.c b/app/test/test_lpm6_perf.c index 1860a99ed6..a09e8611ce 100644 --- a/app/test/test_lpm6_perf.c +++ b/app/test/test_lpm6_perf.c @@ -10,6 +10,7 @@ #include <rte_cycles.h> #include <rte_random.h> +#include <rte_malloc.h> #include <rte_memory.h> #include <rte_lpm6.h> @@ -117,8 +118,14 @@ 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 = + (struct rte_ipv6_addr *)rte_malloc("ip_batch", + sizeof(struct rte_ipv6_addr) * NUM_IPS_ENTRIES, 0); + TEST_LPM_ASSERT(ip_batch != NULL); + + int32_t *next_hops = (int32_t *)rte_malloc("next_hops", + sizeof(int32_t) * NUM_IPS_ENTRIES, 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 +160,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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] app/test: fix stack overflow in lpm6_perf_autotest 2024-12-13 17:08 ` [PATCH v2] " Andre Muezerie @ 2024-12-13 17:15 ` Stephen Hemminger 2024-12-18 15:12 ` Andre Muezerie 0 siblings, 1 reply; 11+ messages in thread From: Stephen Hemminger @ 2024-12-13 17:15 UTC (permalink / raw) To: Andre Muezerie; +Cc: bruce.richardson, dev, vladimir.medvedkin On Fri, 13 Dec 2024 09:08:22 -0800 Andre Muezerie <andremue@linux.microsoft.com> wrote: > + struct rte_ipv6_addr *ip_batch = > + (struct rte_ipv6_addr *)rte_malloc("ip_batch", > + sizeof(struct rte_ipv6_addr) * NUM_IPS_ENTRIES, 0 Cast is not needed here. If you are going to allocate an array, use calloc() or rte_calloc() ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] app/test: fix stack overflow in lpm6_perf_autotest 2024-12-13 17:15 ` Stephen Hemminger @ 2024-12-18 15:12 ` Andre Muezerie 0 siblings, 0 replies; 11+ messages in thread From: Andre Muezerie @ 2024-12-18 15:12 UTC (permalink / raw) To: Stephen Hemminger; +Cc: bruce.richardson, dev, vladimir.medvedkin On Fri, Dec 13, 2024 at 09:15:40AM -0800, Stephen Hemminger wrote: > On Fri, 13 Dec 2024 09:08:22 -0800 > Andre Muezerie <andremue@linux.microsoft.com> wrote: > > > + struct rte_ipv6_addr *ip_batch = > > + (struct rte_ipv6_addr *)rte_malloc("ip_batch", > > + sizeof(struct rte_ipv6_addr) * NUM_IPS_ENTRIES, 0 > > Cast is not needed here. > If you are going to allocate an array, use calloc() or rte_calloc() Thanks for the comments. I'll update the patch. ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3] app/test: fix stack overflow in lpm6_perf_autotest 2024-12-13 2:39 [PATCH] app/test: fix stack overflow in lpm6_perf_autotest Andre Muezerie 2024-12-13 10:22 ` Medvedkin, Vladimir 2024-12-13 17:08 ` [PATCH v2] " Andre Muezerie @ 2024-12-18 15:21 ` Andre Muezerie 2025-03-05 10:08 ` Bruce Richardson 2 siblings, 1 reply; 11+ messages in thread From: Andre Muezerie @ 2024-12-18 15:21 UTC (permalink / raw) To: andremue; +Cc: stephen, bruce.richardson, dev, vladimir.medvedkin 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 <andremue@linux.microsoft.com> --- 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 <rte_cycles.h> #include <rte_random.h> +#include <rte_malloc.h> #include <rte_memory.h> #include <rte_lpm6.h> @@ -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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3] app/test: fix stack overflow in lpm6_perf_autotest 2024-12-18 15:21 ` [PATCH v3] " Andre Muezerie @ 2025-03-05 10:08 ` Bruce Richardson 2025-03-05 14:45 ` Andre Muezerie 0 siblings, 1 reply; 11+ messages in thread From: Bruce Richardson @ 2025-03-05 10:08 UTC (permalink / raw) To: Andre Muezerie; +Cc: stephen, dev, vladimir.medvedkin On Wed, Dec 18, 2024 at 07:21:26AM -0800, Andre Muezerie wrote: > 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 <andremue@linux.microsoft.com> > --- > 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 <rte_cycles.h> > #include <rte_random.h> > +#include <rte_malloc.h> > #include <rte_memory.h> > #include <rte_lpm6.h> > > @@ -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); > While I don't think we need to use the "rte_" versions of allocation, this is still an ok fix - and I see that in v1 regular malloc was used. With either calloc or rte_calloc used. Acked-by: Bruce Richardson <bruce.richardson@intel.com> > 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 > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3] app/test: fix stack overflow in lpm6_perf_autotest 2025-03-05 10:08 ` Bruce Richardson @ 2025-03-05 14:45 ` Andre Muezerie 2025-03-05 20:04 ` Medvedkin, Vladimir 0 siblings, 1 reply; 11+ messages in thread From: Andre Muezerie @ 2025-03-05 14:45 UTC (permalink / raw) To: Bruce Richardson; +Cc: stephen, dev, vladimir.medvedkin On Wed, Mar 05, 2025 at 10:08:33AM +0000, Bruce Richardson wrote: > On Wed, Dec 18, 2024 at 07:21:26AM -0800, Andre Muezerie wrote: > > 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 <andremue@linux.microsoft.com> > > --- > > 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 <rte_cycles.h> > > #include <rte_random.h> > > +#include <rte_malloc.h> > > #include <rte_memory.h> > > #include <rte_lpm6.h> > > > > @@ -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); > > > > While I don't think we need to use the "rte_" versions of allocation, this > is still an ok fix - and I see that in v1 regular malloc was used. The reviewers had different opinions on which allocator function should be used, that's why it was changed. Thanks for being flexible on this. > > With either calloc or rte_calloc used. > > Acked-by: Bruce Richardson <bruce.richardson@intel.com> > > > > 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 > > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3] app/test: fix stack overflow in lpm6_perf_autotest 2025-03-05 14:45 ` Andre Muezerie @ 2025-03-05 20:04 ` Medvedkin, Vladimir 0 siblings, 0 replies; 11+ messages in thread From: Medvedkin, Vladimir @ 2025-03-05 20:04 UTC (permalink / raw) To: Andre Muezerie, Bruce Richardson; +Cc: stephen, dev [-- Attachment #1: Type: text/plain, Size: 2433 bytes --] Hi Andre, On 05/03/2025 14:45, Andre Muezerie wrote: > On Wed, Mar 05, 2025 at 10:08:33AM +0000, Bruce Richardson wrote: >> On Wed, Dec 18, 2024 at 07:21:26AM -0800, Andre Muezerie wrote: >>> 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<andremue@linux.microsoft.com> >>> --- >>> 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 <rte_cycles.h> >>> #include <rte_random.h> >>> +#include <rte_malloc.h> >>> #include <rte_memory.h> >>> #include <rte_lpm6.h> >>> >>> @@ -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); >>> >> While I don't think we need to use the "rte_" versions of allocation, this >> is still an ok fix - and I see that in v1 regular malloc was used. > The reviewers had different opinions on which allocator function > should be used, that's why it was changed. Thanks for being flexible on this. As I mentioned earlier, I think it's better to use the memory allocated from hugepages here since we are measuring performance. Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com> > >> With either calloc or rte_calloc used. >> >> Acked-by: Bruce Richardson<bruce.richardson@intel.com> >> >> >>> 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 >>> -- Regards, Vladimir [-- Attachment #2: Type: text/html, Size: 39173 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2025-03-05 20:05 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-12-13 2:39 [PATCH] app/test: fix stack overflow in lpm6_perf_autotest Andre Muezerie 2024-12-13 10:22 ` Medvedkin, Vladimir 2024-12-13 17:05 ` Andre Muezerie 2024-12-13 17:08 ` Stephen Hemminger 2024-12-13 17:08 ` [PATCH v2] " Andre Muezerie 2024-12-13 17:15 ` Stephen Hemminger 2024-12-18 15:12 ` Andre Muezerie 2024-12-18 15:21 ` [PATCH v3] " Andre Muezerie 2025-03-05 10:08 ` Bruce Richardson 2025-03-05 14:45 ` Andre Muezerie 2025-03-05 20:04 ` Medvedkin, Vladimir
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).