DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Medvedkin, Vladimir" <vladimir.medvedkin@intel.com>
To: Andre Muezerie <andremue@linux.microsoft.com>,
	Bruce Richardson <bruce.richardson@intel.com>
Cc: <stephen@networkplumber.org>, <dev@dpdk.org>
Subject: Re: [PATCH v3] app/test: fix stack overflow in lpm6_perf_autotest
Date: Wed, 5 Mar 2025 20:04:49 +0000	[thread overview]
Message-ID: <0513cfe3-ea93-42f5-b052-20df56fc7127@intel.com> (raw)
In-Reply-To: <20250305144531.GA32194@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>

[-- 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 --]

      reply	other threads:[~2025-03-05 20:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-13  2:39 [PATCH] " 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 message]

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=0513cfe3-ea93-42f5-b052-20df56fc7127@intel.com \
    --to=vladimir.medvedkin@intel.com \
    --cc=andremue@linux.microsoft.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /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).