Reputation: 81
I am working with an application written using DPDK-1.6.0r0 and I want to debug it. My first idea was to use gdb, but I got this error: EAL: No free hugepages reported in hugepages-2048kB
I compiled the environment ih this way:
make install T=x86_64-default-linuxapp-gcc EXTRA_CFLAGS='-g -ggdb'
1
hugepages reservation:
cd /tmp
sudo mkdir -p /mnt/huge
grep -s '/mnt/huge' /proc/mounts > /dev/null
if [ $? -ne 0 ] ; then
sudo mount -t hugetlbfs nodev /mnt/huge
fi
Pages=256
echo "echo $Pages > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages" > .echo_tmp
echo "Reserving hugepages"
sudo sh .echo_tmp
rm -f .echo_tmp
and then I run the app with gdb:
gdb appname`
...
(gdb) start appname -c 7e -n 3 --no-hpet -- -p 1`
Do you have some idea to solve it?
Upvotes: 2
Views: 4270
Reputation: 3
In the below approach I assume you are able to start your application without any problem. If you are able to start your application you can try below trick which I always do for my application to debug in GDB. Make sure you have compiled the DPDK libraries with GDB flag which you would be doing anyway.
int loop_hack=1
while(loop_hack);
With the above your application would wait in a loop from the beginning. Once your app is successfully started with all arguments then attach it to gdb. Not the PID of your application
gdb <app_withsymbol> -p <pid>
set loop_hack=0
c
Upvotes: 0
Reputation: 2194
You can debug DPDK app in hugepage with GDB, that's not a problem. hugepage only involves some setup (hugetlbfs mapping, rte_memseg setup, using rte_malloc) and during runtime, it should look the same as normal pages.
Yeah, the comments are right, you have to be root to access hugepage. There is somewhere that said by making hugepage mounting point accessible to non-privileged user, you can start DPDK app. However, that's no longer correct any more, as Linux has added /proc/self/pagemap access control to users with CAP_SYS_ADMIN capabilities due to security concern. Without pgemap, DPDK won't work as it can't find physical address mapping for its pull mode driver DMA.
https://www.kernel.org/doc/Documentation/vm/pagemap.txt
Upvotes: 1
Reputation: 672
Use the --no-huge
and -m
EAL options, thus you don't need the hugepages.
For instance, using 128MB of "malloc" memory with GDB:
gdb --args appname -c 7e -n 3 --no-hpet --no-huge -m 128 -- -p 1
If you really want to use the hugepages with a specific mount point use the --huge-dir
EAL option:
gdb --args appname -c 7e -n 3 --no-hpet --huge-dir /mnt/huge -- -p 1
Upvotes: 3