* [dpdk-users] segmentation fault after using rte_malloc() @ 2019-04-19 1:11 曾懷恩 2019-04-19 2:59 ` Stephen Hemminger 0 siblings, 1 reply; 12+ messages in thread From: 曾懷恩 @ 2019-04-19 1:11 UTC (permalink / raw) To: users 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'; ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-users] segmentation fault after using rte_malloc() 2019-04-19 1:11 [dpdk-users] segmentation fault after using rte_malloc() 曾懷恩 @ 2019-04-19 2:59 ` Stephen Hemminger 2019-04-19 3:31 ` 曾懷恩 0 siblings, 1 reply; 12+ messages in thread From: Stephen Hemminger @ 2019-04-19 2:59 UTC (permalink / raw) To: 曾懷恩; +Cc: users 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? ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-users] segmentation fault after using rte_malloc() 2019-04-19 2:59 ` Stephen Hemminger @ 2019-04-19 3:31 ` 曾懷恩 2019-04-20 20:29 ` Wiles, Keith 0 siblings, 1 reply; 12+ messages in thread From: 曾懷恩 @ 2019-04-19 3:31 UTC (permalink / raw) To: Stephen Hemminger; +Cc: users 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. > 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? ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-users] segmentation fault after using rte_malloc() 2019-04-19 3:31 ` 曾懷恩 @ 2019-04-20 20:29 ` Wiles, Keith 2019-04-22 6:43 ` 曾懷恩 0 siblings, 1 reply; 12+ messages in thread From: Wiles, Keith @ 2019-04-20 20:29 UTC (permalink / raw) To: 曾懷恩; +Cc: Stephen Hemminger, users 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? > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-users] segmentation fault after using rte_malloc() 2019-04-20 20:29 ` Wiles, Keith @ 2019-04-22 6:43 ` 曾懷恩 2019-04-22 13:09 ` Wiles, Keith 0 siblings, 1 reply; 12+ messages in thread From: 曾懷恩 @ 2019-04-22 6:43 UTC (permalink / raw) To: Wiles, Keith; +Cc: Stephen Hemminger, users 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@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? >> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-users] segmentation fault after using rte_malloc() 2019-04-22 6:43 ` 曾懷恩 @ 2019-04-22 13:09 ` Wiles, Keith 2019-04-23 17:34 ` 曾懷恩 0 siblings, 1 reply; 12+ messages in thread From: Wiles, Keith @ 2019-04-22 13:09 UTC (permalink / raw) To: 曾懷恩; +Cc: Stephen Hemminger, users > 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 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-users] segmentation fault after using rte_malloc() 2019-04-22 13:09 ` Wiles, Keith @ 2019-04-23 17:34 ` 曾懷恩 2019-04-24 14:22 ` 曾懷恩 0 siblings, 1 reply; 12+ messages in thread From: 曾懷恩 @ 2019-04-23 17:34 UTC (permalink / raw) To: Wiles, Keith; +Cc: Stephen Hemminger, users 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 > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-users] segmentation fault after using rte_malloc() 2019-04-23 17:34 ` 曾懷恩 @ 2019-04-24 14:22 ` 曾懷恩 2019-04-24 14:38 ` Wiles, Keith 0 siblings, 1 reply; 12+ messages in thread From: 曾懷恩 @ 2019-04-24 14:22 UTC (permalink / raw) To: Wiles, Keith; +Cc: Stephen Hemminger, users Hi Keith, I have tried DPDK 19.05-rc2, 19.02, 18.11 on VMware e1000 driver, Dell R630 with Mellanox Connectx-3 and Intel X520 However I still got segmentation fault with all above setting here are my settings : With CX3 modprobe -a ib_uverbs mlx4_en mlx4_core mlx4_ib /etc/init.d/openibd restart ls -d /sys/class/net/*/device/infiniband_verbs/uverbs* | cut -d / -f 5 { for intf in ens3 ens8; do (cd "/sys/class/net/${intf}/device/" && pwd -P); done; } | sed -n 's,.*/\(.*\),-w \1,p' mount -t hugetlbfs nodev /mnt/huge With X520 and e1000: mount -t hugetlbfs nodev /mnt/huge modprobe uio insmod dpdk-18.11/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko /root/dpdk-18.11//usertools/dpdk-devbind.py --bind=igb_uio 00:0a.0 /root/dpdk-18.11//usertools/dpdk-devbind.py --bind=igb_uio 00:08.0 My OS is CentOS 7.5 in KVM with SRIOV enable hugepage size is set to 2MB Thanks for reply Best Regard, > 曾懷恩 <the@csie.io> 於 2019年4月24日 上午1:34 寫道: > > 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 >> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-users] segmentation fault after using rte_malloc() 2019-04-24 14:22 ` 曾懷恩 @ 2019-04-24 14:38 ` Wiles, Keith 2019-04-25 3:55 ` 曾懷恩 0 siblings, 1 reply; 12+ messages in thread From: Wiles, Keith @ 2019-04-24 14:38 UTC (permalink / raw) To: 曾懷恩; +Cc: Stephen Hemminger, users > On Apr 24, 2019, at 9:22 AM, 曾懷恩 <the@csie.io> wrote: > > Hi Keith, > > I have tried DPDK 19.05-rc2, 19.02, 18.11 on VMware e1000 driver, Dell R630 with Mellanox Connectx-3 and Intel X520 > > However I still got segmentation fault with all above setting So you are using the simple example and you get a invalid rte_malloc memory? I do not know how to debug this problem as it sounds like a race condition or memory corruption. The simple example code is doing the right things to use that API, so if you are getting the same memory address returned then I would use GDB and set a hardware break point to try to see where this is going wrong. Not much help as I can not reproduce the problem. We know that DPDK works, what we need to find out is why it does not work in your platform. Try different size mallocs, but just shooting in the dark here. Now rte_malloc(2) of two bytes is a real waste of memory as the over head for a 2 byte request is very high. > > here are my settings : > > With CX3 > > modprobe -a ib_uverbs mlx4_en mlx4_core mlx4_ib > /etc/init.d/openibd restart > ls -d /sys/class/net/*/device/infiniband_verbs/uverbs* | cut -d / -f 5 > { > for intf in ens3 ens8; > do > (cd "/sys/class/net/${intf}/device/" && pwd -P); > done; > } | > sed -n 's,.*/\(.*\),-w \1,p' > mount -t hugetlbfs nodev /mnt/huge > > With X520 and e1000: > > mount -t hugetlbfs nodev /mnt/huge > modprobe uio > insmod dpdk-18.11/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko > /root/dpdk-18.11//usertools/dpdk-devbind.py --bind=igb_uio 00:0a.0 > /root/dpdk-18.11//usertools/dpdk-devbind.py --bind=igb_uio 00:08.0 > > My OS is CentOS 7.5 in KVM with SRIOV enable > > hugepage size is set to 2MB > > Thanks for reply > > Best Regard, > >> 曾懷恩 <the@csie.io> 於 2019年4月24日 上午1:34 寫道: >> >> 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 >>> > Regards, Keith ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-users] segmentation fault after using rte_malloc() 2019-04-24 14:38 ` Wiles, Keith @ 2019-04-25 3:55 ` 曾懷恩 2019-04-25 4:18 ` Wiles, Keith 0 siblings, 1 reply; 12+ messages in thread From: 曾懷恩 @ 2019-04-25 3:55 UTC (permalink / raw) To: Wiles, Keith; +Cc: Stephen Hemminger, users Hi Keith, > Wiles, Keith <keith.wiles@intel.com> 於 2019年4月24日 下午10:38 寫道: > > > >> On Apr 24, 2019, at 9:22 AM, 曾懷恩 <the@csie.io <mailto:the@csie.io>> wrote: >> >> Hi Keith, >> >> I have tried DPDK 19.05-rc2, 19.02, 18.11 on VMware e1000 driver, Dell R630 with Mellanox Connectx-3 and Intel X520 >> >> However I still got segmentation fault with all above setting > > So you are using the simple example and you get a invalid rte_malloc memory? Yes > > I do not know how to debug this problem as it sounds like a race condition or memory corruption. Do you mean that there is another process using this memory space? As far as I know, while calling rte_malloc(), it will search a free memory space and return the address. > > The simple example code is doing the right things to use that API, so if you are getting the same memory address returned then I would use GDB and set a hardware break point to try to see where this is going wrong. Not much help as I can not reproduce the problem. thank you, I will try GDB later, btw, actually I got same memory address return by rte_malloc(). > > We know that DPDK works, what we need to find out is why it does not work in your platform. Try different size mallocs, but just shooting in the dark here. Now rte_malloc(2) of two bytes is a real waste of memory as the over head for a 2 byte request is very high. So the rte_malloc() is not suggested to use? I saw it’s a replacement of glibc malloc() in DPDK doc. Or should I declare a larger size to make the memory space not to be fragmented? Thanks a lot. Best Regards, > >> >> here are my settings : >> >> With CX3 >> >> modprobe -a ib_uverbs mlx4_en mlx4_core mlx4_ib >> /etc/init.d/openibd restart >> ls -d /sys/class/net/*/device/infiniband_verbs/uverbs* | cut -d / -f 5 >> { >> for intf in ens3 ens8; >> do >> (cd "/sys/class/net/${intf}/device/" && pwd -P); >> done; >> } | >> sed -n 's,.*/\(.*\),-w \1,p' >> mount -t hugetlbfs nodev /mnt/huge >> >> With X520 and e1000: >> >> mount -t hugetlbfs nodev /mnt/huge >> modprobe uio >> insmod dpdk-18.11/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko >> /root/dpdk-18.11//usertools/dpdk-devbind.py --bind=igb_uio 00:0a.0 >> /root/dpdk-18.11//usertools/dpdk-devbind.py --bind=igb_uio 00:08.0 >> >> My OS is CentOS 7.5 in KVM with SRIOV enable >> >> hugepage size is set to 2MB >> >> Thanks for reply >> >> Best Regard, >> >>> 曾懷恩 <the@csie.io> 於 2019年4月24日 上午1:34 寫道: >>> >>> 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 >>>> >> > > Regards, > Keith ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-users] segmentation fault after using rte_malloc() 2019-04-25 3:55 ` 曾懷恩 @ 2019-04-25 4:18 ` Wiles, Keith 0 siblings, 0 replies; 12+ messages in thread From: Wiles, Keith @ 2019-04-25 4:18 UTC (permalink / raw) To: 曾懷恩; +Cc: Stephen Hemminger, users Sent from my iPhone On Apr 24, 2019, at 10:55 PM, 曾懷恩 <the@csie.io<mailto:the@csie.io>> wrote: Hi Keith, Wiles, Keith <keith.wiles@intel.com<mailto:keith.wiles@intel.com>> 於 2019年4月24日 下午10:38 寫道: On Apr 24, 2019, at 9:22 AM, 曾懷恩 <the@csie.io<mailto:the@csie.io>> wrote: Hi Keith, I have tried DPDK 19.05-rc2, 19.02, 18.11 on VMware e1000 driver, Dell R630 with Mellanox Connectx-3 and Intel X520 However I still got segmentation fault with all above setting So you are using the simple example and you get a invalid rte_malloc memory? Yes I do not know how to debug this problem as it sounds like a race condition or memory corruption. Do you mean that there is another process using this memory space? As far as I know, while calling rte_malloc(), it will search a free memory space and return the address. Yes but it pulls the memory from the huge pages. Small memory allocations using rte_malloc is not a great use of rte_malloc it would be better if you used malloc. The rte_malloc is great for packets or large segments of memory. If you need the memory in huge pages then it would have been better to allocate a large segment and handle it yourself. The simple example code is doing the right things to use that API, so if you are getting the same memory address returned then I would use GDB and set a hardware break point to try to see where this is going wrong. Not much help as I can not reproduce the problem. thank you, I will try GDB later, btw, actually I got same memory address return by rte_malloc(). We know that DPDK works, what we need to find out is why it does not work in your platform. Try different size mallocs, but just shooting in the dark here. Now rte_malloc(2) of two bytes is a real waste of memory as the over head for a 2 byte request is very high. So the rte_malloc() is not suggested to use? I saw it’s a replacement of glibc malloc() in DPDK doc. It’s not a replacement for malloc and small allocations as you were doing. You can use rte_malloc but you need to be careful how you use it. Or should I declare a larger size to make the memory space not to be fragmented? Thanks a lot. Best Regards, here are my settings : With CX3 modprobe -a ib_uverbs mlx4_en mlx4_core mlx4_ib /etc/init.d/openibd restart ls -d /sys/class/net/*/device/infiniband_verbs/uverbs* | cut -d / -f 5 { for intf in ens3 ens8; do (cd "/sys/class/net/${intf}/device/" && pwd -P); done; } | sed -n 's,.*/\(.*\),-w \1,p' mount -t hugetlbfs nodev /mnt/huge With X520 and e1000: mount -t hugetlbfs nodev /mnt/huge modprobe uio insmod dpdk-18.11/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko /root/dpdk-18.11//usertools/dpdk-devbind.py --bind=igb_uio 00:0a.0 /root/dpdk-18.11//usertools/dpdk-devbind.py --bind=igb_uio 00:08.0 My OS is CentOS 7.5 in KVM with SRIOV enable hugepage size is set to 2MB Thanks for reply Best Regard, 曾懷恩 <the@csie.io<mailto:the@csie.io>> 於 2019年4月24日 上午1:34 寫道: 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<mailto:keith.wiles@intel.com>> 於 2019年4月22日 下午9:09 寫道: On Apr 22, 2019, at 1:43 AM, 曾懷恩 <the@csie.io<mailto: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<mailto:keith.wiles@intel.com>> 於 2019年4月21日 上午4:29 寫道: Sent from my iPhone On Apr 18, 2019, at 11:31 PM, 曾懷恩 <the@csie.io<mailto: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<mailto:stephen@networkplumber.org>> 於 2019年4月19日 上午10:59 寫道: On Fri, 19 Apr 2019 09:11:05 +0800 曾懷恩 <the@csie.io<mailto: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 Regards, Keith ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-users] segmentation fault after using rte_malloc() @ 2020-07-24 4:07 Logan Von 0 siblings, 0 replies; 12+ messages in thread From: Logan Von @ 2020-07-24 4:07 UTC (permalink / raw) To: users Hi, I face the same issue today, and later I found that although the program can pass the compilation process, I forgot to include the rte_malloc.h header file. Hope this can help you. Best regards, Logan Von ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2020-07-24 4:07 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-04-19 1:11 [dpdk-users] segmentation fault after using rte_malloc() 曾懷恩 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 ` 曾懷恩 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
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).