From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id A1B78A05D3 for ; Thu, 25 Apr 2019 06:18:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 07DBB1B537; Thu, 25 Apr 2019 06:18:14 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 567891B536 for ; Thu, 25 Apr 2019 06:18:12 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Apr 2019 21:18:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,392,1549958400"; d="scan'208,217";a="340572919" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga005.fm.intel.com with ESMTP; 24 Apr 2019 21:18:10 -0700 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 24 Apr 2019 21:18:10 -0700 Received: from fmsmsx117.amr.corp.intel.com ([169.254.3.26]) by fmsmsx123.amr.corp.intel.com ([169.254.7.229]) with mapi id 14.03.0415.000; Wed, 24 Apr 2019 21:18:10 -0700 From: "Wiles, Keith" To: =?iso-2022-jp?B?GyRCQT1YZzI4GyhC?= CC: Stephen Hemminger , "users@dpdk.org" Thread-Topic: [dpdk-users] segmentation fault after using rte_malloc() Thread-Index: AQHU9kzR3X3b+IXxAUykg+o/uxvgrqZDQKAAgAAI3ICAAjlKzYACs1CAgABrygCAAdxfAIABXNCAgAAEgwCAAN6cgP//kQBE Date: Thu, 25 Apr 2019 04:18:09 +0000 Message-ID: <0109BBF2-C8FD-457B-9D28-4DB13560DC9C@intel.com> References: <5BDADE86-3D04-4BE5-AC95-03BE123ED42B@csie.io> <20190418195944.04c4cec5@hermes.lan> <774EEFED-F56A-426E-93FA-92BF9584DD4E@csie.io> <49831062-D811-42F2-A92C-AD8962039E7B@csie.io> <7C65E563-6C35-4F09-A449-B7BD110AA57E@csie.io> <3B412398-9E6F-45E3-8604-145CA96A27CC@intel.com>, In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-users] segmentation fault after using rte_malloc() X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: users-bounces@dpdk.org Sender: "users" Sent from my iPhone On Apr 24, 2019, at 10:55 PM, =1B$BA=3DXg28=1B(B > wrote: Hi Keith, Wiles, Keith > =1B$B1w= =1B(B 2019=1B$BG/=1B(B4=1B$B7n=1B(B24=1B$BF|=1B(B =1B$B2<8a=1B(B10:38 =1B$B= UmF;!'=1B(B On Apr 24, 2019, at 9:22 AM, =1B$BA=3DXg28=1B(B > 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 u= sing 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 memor= y. If you need the memory in huge pages then it would have been better to a= llocate a large segment and handle it yourself. The simple example code is doing the right things to use that API, so if yo= u 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 h= elp as I can not reproduce the problem. thank you, I will try GDB later, btw, actually I got same memory address re= turn by rte_malloc(). We know that DPDK works, what we need to find out is why it does not work i= n 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=1B$B!G=1B(Bs a replacement of glibc malloc() in DPDK doc. It=1B$B!G=1B(Bs not a replacement for malloc and small allocations as you w= ere 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 fragme= nted? 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=3Digb_uio 00:0a.0 /root/dpdk-18.11//usertools/dpdk-devbind.py --bind=3Digb_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, =1B$BA=3DXg28=1B(B > =1B$B1w=1B(B 2019=1B$B= G/=1B(B4=1B$B7n=1B(B24=1B$BF|=1B(B =1B$B>e8a=1B(B1:34 =1B$BUmF;!'=1B(B 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 > =1B$B1w= =1B(B 2019=1B$BG/=1B(B4=1B$B7n=1B(B22=1B$BF|=1B(B =1B$B2<8a=1B(B9:09 =1B$BU= mF;!'=1B(B On Apr 22, 2019, at 1:43 AM, =1B$BA=3DXg28=1B(B > 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 t= o 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 > =1B$B1w= =1B(B 2019=1B$BG/=1B(B4=1B$B7n=1B(B21=1B$BF|=1B(B =1B$B>e8a=1B(B4:29 =1B$BU= mF;!'=1B(B Sent from my iPhone On Apr 18, 2019, at 11:31 PM, =1B$BA=3DXg28=1B(B > wrote: HI, Stephen, Yes, I set huge page in default_hugepagesz=3D1G hugepagesz=3D1G hugepages= =3D4 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 o= n 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() an= d then do the allocation as your sample code looks and then exit? Does this= cause a segfault? Stephen Hemminger > =1B$B1w=1B(B 2019=1B$BG/=1B(B4=1B$B7n=1B(B19=1B$BF|=1B(B =1B$B>e8a= =1B(B10:59 =1B$BUmF;!'=1B(B On Fri, 19 Apr 2019 09:11:05 +0800 =1B$BA=3DXg28=1B(B > 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 segm= entation fault(core dump) Is something wrong? thanks. rte init =1B$B!D=1B(B =1B$B!D!D!D=1B(B... unsigned char *str1; printf("str1 addr =3D %x\n", str1); str1 =3D rte_malloc(NULL,2,RTE_CACHE_LINE_SIZE); printf("str1 addr =3D %x\n", str1); str1[0] =3D 'a=1B$B!G=1B(B; //segmentation fault here str1[1] =3D '\0'; Do you have huge pages? Did you do eal_init? Regards, Keith Regards, Keith