DPDK usage discussions
 help / color / mirror / Atom feed
* [dpdk-users] segmentation fault when calling rte_pktmbuf_alloc() after calling rte_pktmbuf_pool_create()
@ 2020-06-12  7:41 Huai-En Tseng
  0 siblings, 0 replies; only message in thread
From: Huai-En Tseng @ 2020-06-12  7:41 UTC (permalink / raw)
  To: users

Hi all, there is a weird problem as title, 

When I use rte_pktmbuf_alloc(struct rte_mempool *) and already verify the return value of rte_pktmbuf_pool_create() is not NULL, the process receive segmentation fault.

Following message is out of gdb:

Thread 1 "osw" received signal SIGSEGV, Segmentation fault.
0x00000000005e9f41 in __mempool_generic_get (cache=0x1a7dfc000000000, n=1, obj_table=0x7fffffffdec8, mp=0x101a7df00)
    at /root/dpdk-20.05/x86_64-native-linuxapp-gcc/include/rte_mempool.h:1449
1449            if (unlikely(cache == NULL || n >= cache->size))
(gdb) p cache
$1 = (struct rte_mempool_cache *) 0x1a7dfc000000000
(gdb) bt
#0  0x00000000005e9f41 in __mempool_generic_get (cache=0x1a7dfc000000000, n=1, obj_table=0x7fffffffdeb8, mp=0x101a7df00)
    at /root/dpdk-20.05/x86_64-native-linuxapp-gcc/include/rte_mempool.h:1449
#1  rte_mempool_generic_get (cache=0x1a7dfc000000000, n=1, obj_table=0x7fffffffdeb8, mp=0x101a7df00)
    at /root/dpdk-20.05/x86_64-native-linuxapp-gcc/include/rte_mempool.h:1517
#2  rte_mempool_get_bulk (n=1, obj_table=0x7fffffffdeb8, mp=0x101a7df00)
    at /root/dpdk-20.05/x86_64-native-linuxapp-gcc/include/rte_mempool.h:1552
#3  rte_mempool_get (obj_p=0x7fffffffdeb8, mp=0x101a7df00) at /root/dpdk-20.05/x86_64-native-linuxapp-gcc/include/rte_mempool.h:1578
#4  rte_mbuf_raw_alloc (mp=0x101a7df00) at /root/dpdk-20.05/x86_64-native-linuxapp-gcc/include/rte_mbuf.h:586
#5  rte_pktmbuf_alloc (mp=0x101a7df00) at /root/dpdk-20.05/x86_64-native-linuxapp-gcc/include/rte_mbuf.h:896

And I dig into rte_mempool.h:
and change line 1449-1450 
1449  if (unlikely(cache == NULL || n >= cache->size))
1450         goto ring_dequeue;
to 
1449  if (unlikely(cache == NULL))
1450          goto ring_dequeue;
1451  if (unlikely(n >= cache->size))
1452          goto ring_dequeue;

and it also fail at line 1451

the gdb output message after changing: 

Thread 1 "osw" received signal SIGSEGV, Segmentation fault.
__mempool_generic_get (cache=0x1a7dfc000000000, n=1, obj_table=0x7fffffffdeb8, mp=0x101a7df00)
    at /root/dpdk-20.05/x86_64-native-linuxapp-gcc/include/rte_mempool.h:1451
1451            if (unlikely(n >= cache->size))
(gdb) p cache
$1 = (struct rte_mempool_cache *) 0x1a7dfc000000000
(gdb) bt
#0  __mempool_generic_get (cache=0x1a7dfc000000000, n=1, obj_table=0x7fffffffdeb8, mp=0x101a7df00)
    at /root/dpdk-20.05/x86_64-native-linuxapp-gcc/include/rte_mempool.h:1451
#1  rte_mempool_generic_get (cache=0x1a7dfc000000000, n=1, obj_table=0x7fffffffdeb8, mp=0x101a7df00)
    at /root/dpdk-20.05/x86_64-native-linuxapp-gcc/include/rte_mempool.h:1519
#2  rte_mempool_get_bulk (n=1, obj_table=0x7fffffffdeb8, mp=0x101a7df00)
    at /root/dpdk-20.05/x86_64-native-linuxapp-gcc/include/rte_mempool.h:1554
#3  rte_mempool_get (obj_p=0x7fffffffdeb8, mp=0x101a7df00) at /root/dpdk-20.05/x86_64-native-linuxapp-gcc/include/rte_mempool.h:1580
#4  rte_mbuf_raw_alloc (mp=0x101a7df00) at /root/dpdk-20.05/x86_64-native-linuxapp-gcc/include/rte_mbuf.h:586
#5  rte_pktmbuf_alloc (mp=0x101a7df00) at /root/dpdk-20.05/x86_64-native-linuxapp-gcc/include/rte_mbuf.h:896
#6  main (argc=<optimized out>, argv=<optimized out>) at ofpd.c:150
(gdb) p cache->size
Cannot access memory at address 0x1a7dfc000000000

It looks like the memory address “cache” pointer stored is not NULL but it actually is a NULL pointer.

Does anyone know this issue?

The DPDK version is 20.05, I also tried 18.11 and 19.11.

OS is CentOS 8.1 kernel is 4.18.0-147.el8.x86_64.

I have reduce my code in program to just calling rte_eal_init() then rte_pktmbuf_pool_create() and rte_pktmbuf_alloc().

Thanks.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-12  7:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-12  7:41 [dpdk-users] segmentation fault when calling rte_pktmbuf_alloc() after calling rte_pktmbuf_pool_create() Huai-En Tseng

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).