[dpdk-users] segmentation fault after using rte_malloc()
曾懷恩
the at csie.io
Mon Apr 22 08:43:19 CEST 2019
Hi Wiles,
here is my sample code with just doing rte_eal_init() and rte_malloc() .
-------------- next part --------------
-------------- next part --------------
And my start eal cmdline option is ./build/test -l 0-1 -n 4
Thank you very much for your reply
> Wiles, Keith <keith.wiles at intel.com> ? 2019?4?21? ??4:29 ???
>
>
>
> Sent from my iPhone
>
>> On Apr 18, 2019, at 11:31 PM, ??? <the at csie.io> wrote:
>>
>> HI, Stephen,
>>
>> Yes, I set huge page in default_hugepagesz=1G hugepagesz=1G hugepages=4
>>
>> and also did rte_eal_init at the beginning of my program.
>>
>> thanks for reply.
>
> Is the core doing the rte_malloc one of the cores listed in the core list on the command line. In other words the pthread doing the allocation should be the master lcore or one of the slave lcores.
>
> Also I seems like a very simple test case, can you do the rte_eal_init() and then do the allocation as your sample code looks and then exit? Does this cause a segfault?
>>
>>
>>> Stephen Hemminger <stephen at networkplumber.org> ? 2019?4?19? ??10:59 ???
>>>
>>> On Fri, 19 Apr 2019 09:11:05 +0800
>>> ??? <the at csie.io> wrote:
>>>
>>>> Hi all,
>>>>
>>>> i have 1 problem while using rte_malloc
>>>>
>>>> Every time I use this function and use the memory it returns, it shows segmentation fault(core dump)
>>>>
>>>> Is something wrong?
>>>>
>>>> thanks.
>>>>
>>>>
>>>> rte init ?
>>>> ???...
>>>> unsigned char *str1;
>>>> printf("str1 addr = %x\n", str1);
>>>> str1 = rte_malloc(NULL,2,RTE_CACHE_LINE_SIZE);
>>>> printf("str1 addr = %x\n", str1);
>>>> str1[0] = 'a?; //segmentation fault here
>>>> str1[1] = '\0';
>>> Do you have huge pages?
>>> Did you do eal_init?
>>
More information about the users
mailing list