DPDK usage discussions
 help / color / mirror / Atom feed
From: 曾懷恩 <the@csie.io>
To: "Wiles, Keith" <keith.wiles@intel.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	"users@dpdk.org" <users@dpdk.org>
Subject: Re: [dpdk-users] segmentation fault after using rte_malloc()
Date: Wed, 24 Apr 2019 01:34:06 +0800	[thread overview]
Message-ID: <49831062-D811-42F2-A92C-AD8962039E7B@csie.io> (raw)
In-Reply-To: <DE838D63-BF6D-4BEA-A6DE-5CB4BB2AEF3D@intel.com>

Hi Keith,

Yes I ran this program as root 

However I ran it with DPDK 18.11 release.

I will try 19.05 later.

Besides, my cpu is E5-2650 v4.
NICs are Intel x520 DA2 and Mellanox connectx-3

thank you for reply

Best Regards,




> Wiles, Keith <keith.wiles@intel.com> 於 2019年4月22日 下午9:09 寫道:
> 
> 
> 
>> On Apr 22, 2019, at 1:43 AM, 曾懷恩 <the@csie.io> wrote:
>> 
>> Hi Wiles,
>> 
>> here is my sample code with just doing rte_eal_init() and rte_malloc() .
>> 
>> 
>> 
> 
> I tried the attached code and it works on my machine with something close to DPDK 19.05 release.
> 
> I only use 2 Meg pages, but I assumed it would not make any difference.
> 
> Did you run this example as root?
>> 
>> 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@intel.com> 於 2019年4月21日 上午4:29 寫道:
>>> 
>>> 
>>> 
>>> Sent from my iPhone
>>> 
>>>> On Apr 18, 2019, at 11:31 PM, 曾懷恩 <the@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@networkplumber.org> 於 2019年4月19日 上午10:59 寫道:
>>>>> 
>>>>> On Fri, 19 Apr 2019 09:11:05 +0800
>>>>> 曾懷恩 <the@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?
>>>> 
>> 
>> <test.c><Makefile>
> 
> Regards,
> Keith
> 

  reply	other threads:[~2019-04-23 17:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-19  1:11 曾懷恩
2019-04-19  2:59 ` Stephen Hemminger
2019-04-19  3:31   ` 曾懷恩
2019-04-20 20:29     ` Wiles, Keith
2019-04-22  6:43       ` 曾懷恩
2019-04-22 13:09         ` Wiles, Keith
2019-04-23 17:34           ` 曾懷恩 [this message]
2019-04-24 14:22             ` 曾懷恩
2019-04-24 14:38               ` Wiles, Keith
2019-04-25  3:55                 ` 曾懷恩
2019-04-25  4:18                   ` Wiles, Keith
2020-07-24  4:07 Logan Von

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=49831062-D811-42F2-A92C-AD8962039E7B@csie.io \
    --to=the@csie.io \
    --cc=keith.wiles@intel.com \
    --cc=stephen@networkplumber.org \
    --cc=users@dpdk.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).