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 73578A05D3 for ; Thu, 25 Apr 2019 05:55:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 19F041B537; Thu, 25 Apr 2019 05:55:35 +0200 (CEST) Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by dpdk.org (Postfix) with ESMTP id B24001B536 for ; Thu, 25 Apr 2019 05:55:32 +0200 (CEST) Received: by mail-pf1-f180.google.com with SMTP id e67so2554420pfe.10 for ; Wed, 24 Apr 2019 20:55:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=csie-io.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=xBQRIR/2VfXxYVj4LmPzXF2EEb8c0k2oV4G0AWMgX4k=; b=Q/JyS9vVXIUhTD5/iec7+ZNSNeKRX31BVQ7oER33DA79KOFtr6AxrRnNhW5UzN5tGb OIKPNR+M/fQTuK2ZWNzRuxPHsxXGFqQDL/K/oGdgJIoEe0gy0uI6c0QvBwrcNqabaw92 RC1Fb8L9I3mO22Ev7yDvFd17xhLA+vk7y1Voh2KLAOJFT3QOb+5z6MJoBvCA6rnyNafS Db1RfLZyYaHW2ak/Fd2XHYFrw2NY1XuzjxTvS4mYjeQ3Qyc9uy6sQHI/yYkD/KosaviI NiwQfpAcyf6CVfnwRZIzDTAYD5duWOx/8EleaeD5S6Ym4M9Lgr7fSVzQgrv6KtZ/fDgd 4GYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=xBQRIR/2VfXxYVj4LmPzXF2EEb8c0k2oV4G0AWMgX4k=; b=W8YzFL3FhYbrR5wc9fwIq8aPpD61I/wwe1LfQ9YhjYf7mfyMLbCSw0a2WFYgICSHS1 5yPfV4p/2KwY23L+3YkO1uVjyTyxsuRg4vwMjpG+4L2BgUX646VtD1dEviQnyIgVW/DD 60rgyqbh8YSlDRA1ZXYtVo+mragxqiAcfXowDvYkSpHXjl7sRLDlqxW7sMd4pm49/xqE lJWnOmnaooyEu3V26CifINyfWYXsbna+4w7iSIyyO4DQqzFQXAg0NrwkPoY9x4hcZXKA E4sLcSGPrgzQ8grVqLy1bKRZ+z33Ug53KF38Z+jfzv+8zLBbhjbinRaGSjNhdOxPF1aS vW/Q== X-Gm-Message-State: APjAAAXbjsBn8v3xs0Smh83C3DJMrOJE6eePSuDd4pr10/t3gjpz6tCR aNzdCA0annm/5MwmeGR8bK5zu5HI02I= X-Google-Smtp-Source: APXvYqzKpKRR7E6a2ESOyKSDGveoNojivYlMM/bbEtKBQmuhainRIET3cvdAsJd0e9IxcfoxPP6A8A== X-Received: by 2002:a62:e10e:: with SMTP id q14mr19970808pfh.161.1556164531849; Wed, 24 Apr 2019 20:55:31 -0700 (PDT) Received: from 2001-b400-e382-52a8-9933-07f2-77a6-ef4a.emome-ip6.hinet.net (2001-b400-e382-52a8-9933-07f2-77a6-ef4a.emome-ip6.hinet.net. [2001:b400:e382:52a8:9933:7f2:77a6:ef4a]) by smtp.gmail.com with ESMTPSA id b3sm28541079pfi.82.2019.04.24.20.55.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Apr 2019 20:55:31 -0700 (PDT) From: =?utf-8?B?5pu+5oe35oGp?= Message-Id: Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Date: Thu, 25 Apr 2019 11:55:27 +0800 In-Reply-To: <3B412398-9E6F-45E3-8604-145CA96A27CC@intel.com> Cc: Stephen Hemminger , "users@dpdk.org" To: "Wiles, Keith" 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> X-Mailer: Apple Mail (2.3445.104.8) Content-Type: text/plain; charset=utf-8 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" Hi Keith, > Wiles, Keith =E6=96=BC 2019=E5=B9=B44=E6=9C=8824= =E6=97=A5 =E4=B8=8B=E5=8D=8810:38 =E5=AF=AB=E9=81=93=EF=BC=9A >=20 >=20 >=20 >> On Apr 24, 2019, at 9:22 AM, =E6=9B=BE=E6=87=B7=E6=81=A9 > wrote: >>=20 >> Hi Keith, >>=20 >> I have tried DPDK 19.05-rc2, 19.02, 18.11 on VMware e1000 driver, = Dell R630 with Mellanox Connectx-3 and Intel X520 >>=20 >> However I still got segmentation fault with all above setting >=20 > So you are using the simple example and you get a invalid rte_malloc = memory? Yes >=20 > 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?=20 As far as I know, while calling rte_malloc(), it will search a free = memory space and return the address. >=20 > 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(). >=20 > 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=E2=80=99s 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, >=20 >>=20 >> here are my settings :=20 >>=20 >> With CX3=20 >>=20 >> 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 >>=20 >> With X520 and e1000: >>=20 >> 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 >>=20 >> My OS is CentOS 7.5 in KVM with SRIOV enable >>=20 >> hugepage size is set to 2MB >>=20 >> Thanks for reply >>=20 >> Best Regard, >>=20 >>> =E6=9B=BE=E6=87=B7=E6=81=A9 =E6=96=BC 2019=E5=B9=B44=E6=9C= =8824=E6=97=A5 =E4=B8=8A=E5=8D=881:34 =E5=AF=AB=E9=81=93=EF=BC=9A >>>=20 >>> Hi Keith, >>>=20 >>> Yes I ran this program as root=20 >>>=20 >>> However I ran it with DPDK 18.11 release. >>>=20 >>> I will try 19.05 later. >>>=20 >>> Besides, my cpu is E5-2650 v4. >>> NICs are Intel x520 DA2 and Mellanox connectx-3 >>>=20 >>> thank you for reply >>>=20 >>> Best Regards, >>>=20 >>>=20 >>>=20 >>>=20 >>>> Wiles, Keith =E6=96=BC 2019=E5=B9=B44=E6=9C=88= 22=E6=97=A5 =E4=B8=8B=E5=8D=889:09 =E5=AF=AB=E9=81=93=EF=BC=9A >>>>=20 >>>>=20 >>>>=20 >>>>> On Apr 22, 2019, at 1:43 AM, =E6=9B=BE=E6=87=B7=E6=81=A9 = wrote: >>>>>=20 >>>>> Hi Wiles, >>>>>=20 >>>>> here is my sample code with just doing rte_eal_init() and = rte_malloc() . >>>>>=20 >>>>>=20 >>>>>=20 >>>>=20 >>>> I tried the attached code and it works on my machine with something = close to DPDK 19.05 release. >>>>=20 >>>> I only use 2 Meg pages, but I assumed it would not make any = difference. >>>>=20 >>>> Did you run this example as root? >>>>>=20 >>>>> And my start eal cmdline option is ./build/test -l 0-1 -n 4 >>>>>=20 >>>>> Thank you very much for your reply >>>>>> Wiles, Keith =E6=96=BC 2019=E5=B9=B44=E6=9C= =8821=E6=97=A5 =E4=B8=8A=E5=8D=884:29 =E5=AF=AB=E9=81=93=EF=BC=9A >>>>>>=20 >>>>>>=20 >>>>>>=20 >>>>>> Sent from my iPhone >>>>>>=20 >>>>>>> On Apr 18, 2019, at 11:31 PM, =E6=9B=BE=E6=87=B7=E6=81=A9 = wrote: >>>>>>>=20 >>>>>>> HI, Stephen, >>>>>>>=20 >>>>>>> Yes, I set huge page in default_hugepagesz=3D1G hugepagesz=3D1G = hugepages=3D4 >>>>>>>=20 >>>>>>> and also did rte_eal_init at the beginning of my program. >>>>>>>=20 >>>>>>> thanks for reply. >>>>>>=20 >>>>>> 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. >>>>>>=20 >>>>>> 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? >>>>>>>=20 >>>>>>>=20 >>>>>>>> Stephen Hemminger =E6=96=BC = 2019=E5=B9=B44=E6=9C=8819=E6=97=A5 =E4=B8=8A=E5=8D=8810:59 =E5=AF=AB=E9=81= =93=EF=BC=9A >>>>>>>>=20 >>>>>>>> On Fri, 19 Apr 2019 09:11:05 +0800 >>>>>>>> =E6=9B=BE=E6=87=B7=E6=81=A9 wrote: >>>>>>>>=20 >>>>>>>>> Hi all,=20 >>>>>>>>>=20 >>>>>>>>> i have 1 problem while using rte_malloc >>>>>>>>>=20 >>>>>>>>> Every time I use this function and use the memory it returns, = it shows segmentation fault(core dump) >>>>>>>>>=20 >>>>>>>>> Is something wrong? >>>>>>>>>=20 >>>>>>>>> thanks. >>>>>>>>>=20 >>>>>>>>>=20 >>>>>>>>> rte init =E2=80=A6 >>>>>>>>> =E2=80=A6=E2=80=A6=E2=80=A6... >>>>>>>>> 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=E2=80=99; //segmentation fault here >>>>>>>>> str1[1] =3D '\0'; >>>>>>>> Do you have huge pages? >>>>>>>> Did you do eal_init? >>>>>>>=20 >>>>>=20 >>>>> >>>>=20 >>>> Regards, >>>> Keith >>>>=20 >>=20 >=20 > Regards, > Keith