1. 程式人生 > 實用技巧 >dpdk 驅動初始化

dpdk 驅動初始化

[root@localhost memzone]# gdb  build/app/TestMalloc 
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-119.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There 
is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "aarch64-redhat-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /data1/dpdk-19.11/demo/memzone/build/app/TestMalloc...done. (gdb) b
/data1/dpdk-19.11/drivers/net/hinic/hinic_pmd_ethdev.c:3144 Breakpoint 1 at 0x781de4: file /data1/dpdk-19.11/drivers/net/hinic/hinic_pmd_ethdev.c, line 3144. (gdb) set args 3 -c 0xff (gdb) r Starting program: /data1/dpdk-19.11/demo/memzone/build/app/TestMalloc 3 -c 0xff [Thread debugging using libthread_db enabled] Using host libthread_db library
"/lib64/libthread_db.so.1". EAL: Detected 128 lcore(s) EAL: Detected 4 NUMA nodes [New Thread 0xffffbe43d910 (LWP 15888)] EAL: Multi-process socket /var/run/dpdk/rte/mp_socket [New Thread 0xffffbdc2d910 (LWP 15889)] EAL: Selected IOVA mode 'PA' EAL: No available hugepages reported in hugepages-2048kB EAL: Probing VFIO support... EAL: VFIO support initialized [New Thread 0xffffbd40d910 (LWP 15890)] [New Thread 0xffffbcbfd910 (LWP 15891)] [New Thread 0xffffbc3ed910 (LWP 15892)] [New Thread 0xffffbbbdd910 (LWP 15893)] [New Thread 0xffffbb3cd910 (LWP 15894)] [New Thread 0xffffbabbd910 (LWP 15895)] [New Thread 0xffffba3ad910 (LWP 15896)] EAL: PCI device 0000:05:00.0 on NUMA socket 0 EAL: probe driver: 19e5:200 net_hinic EAL: using IOMMU type 1 (Type 1) Breakpoint 1, hinic_pci_probe (pci_drv=0xe231e0 <rte_hinic_pmd>, pci_dev=0x116eac0) at /data1/dpdk-19.11/drivers/net/hinic/hinic_pmd_ethdev.c:3147 3147 return rte_eth_dev_pci_generic_probe(pci_dev, (gdb) bt #0 hinic_pci_probe (pci_drv=0xe231e0 <rte_hinic_pmd>, pci_dev=0x116eac0) at /data1/dpdk-19.11/drivers/net/hinic/hinic_pmd_ethdev.c:3147 #1 0x00000000005d7cbc in rte_pci_probe_one_driver (dr=0xe231e0 <rte_hinic_pmd>, dev=0x116eac0) at /data1/dpdk-19.11/drivers/bus/pci/pci_common.c:199 #2 0x00000000005d7eb4 in pci_probe_all_drivers (dev=0x116eac0) at /data1/dpdk-19.11/drivers/bus/pci/pci_common.c:274 #3 0x00000000005d7f80 in rte_pci_probe () at /data1/dpdk-19.11/drivers/bus/pci/pci_common.c:309 #4 0x00000000005a5588 in rte_bus_probe () at /data1/dpdk-19.11/lib/librte_eal/common/eal_common_bus.c:72 #5 0x000000000058a948 in rte_eal_init (argc=4, argv=0xfffffffff558) at /data1/dpdk-19.11/lib/librte_eal/linux/eal/eal.c:1258 #6 0x0000000000464d24 in main (argc=4, argv=0xfffffffff558) at /data1/dpdk-19.11/demo/memzone/main.c:40 (gdb) p *pci_dev $1 = {next = {tqe_next = 0x1113120, tqe_prev = 0x1105fc0}, device = {next = {tqe_next = 0x0, tqe_prev = 0x0}, name = 0x11753e0 "0000:05:00.0", driver = 0x0, bus = 0xe1db18 <rte_pci_bus>, numa_node = 0, devargs = 0x0}, addr = {domain = 0, bus = 5 '\005', devid = 0 '\000', function = 0 '\000'}, id = {class_id = 131072, vendor_id = 6629, device_id = 512, subsystem_vendor_id = 6629, subsystem_device_id = 53561}, mem_resource = { {phys_addr = 8796221997056, len = 131072, addr = 0x8300000000}, {phys_addr = 0, len = 0, addr = 0x0}, { phys_addr = 8796237856768, len = 32768, addr = 0x0}, {phys_addr = 0, len = 0, addr = 0x0}, { phys_addr = 8796095119360, len = 1048576, addr = 0x8300030000}, {phys_addr = 0, len = 0, addr = 0x0}}, intr_handle = {{vfio_dev_fd = 62, uio_cfg_fd = 62}, fd = 63, type = RTE_INTR_HANDLE_VFIO_MSIX, max_intr = 0, nb_efd = 0, efd_counter_size = 0 '\000', efds = {0 <repeats 512 times>}, elist = {{status = 0, fd = 0, epfd = 0, epdata = {event = 0, data = 0x0, cb_fun = 0x0, cb_arg = 0x0}} <repeats 512 times>}, intr_vec = 0x0}, driver = 0xe231e0 <rte_hinic_pmd>, max_vfs = 0, kdrv = RTE_KDRV_VFIO, name = "0000:05:00.0\000\000\000\000\000", vfio_req_intr_handle = {{vfio_dev_fd = 62, uio_cfg_fd = 62}, fd = 64, type = RTE_INTR_HANDLE_VFIO_REQ, max_intr = 0, nb_efd = 0, efd_counter_size = 0 '\000', efds = { 0 <repeats 512 times>}, elist = {{status = 0, fd = 0, epfd = 0, epdata = {event = 0, data = 0x0, cb_fun = 0x0, cb_arg = 0x0}} <repeats 512 times>}, intr_vec = 0x0}} (gdb) set print pretty on (gdb) p *pci_dev $2 = { next = { tqe_next = 0x1113120, tqe_prev = 0x1105fc0 }, device = { next = { tqe_next = 0x0, tqe_prev = 0x0 }, name = 0x11753e0 "0000:05:00.0", driver = 0x0, bus = 0xe1db18 <rte_pci_bus>, numa_node = 0, devargs = 0x0 }, addr = { domain = 0, bus = 5 '\005', devid = 0 '\000', function = 0 '\000' }, id = { class_id = 131072, vendor_id = 6629, device_id = 512, subsystem_vendor_id = 6629, subsystem_device_id = 53561 }, mem_resource = {{ phys_addr = 8796221997056, ---Type <return> to continue, or q <return> to quit--- len = 131072, addr = 0x8300000000 }, { phys_addr = 0, len = 0, addr = 0x0 }, { phys_addr = 8796237856768, len = 32768, addr = 0x0 }, { phys_addr = 0, len = 0, addr = 0x0 }, { phys_addr = 8796095119360, len = 1048576, addr = 0x8300030000 }, { phys_addr = 0, len = 0, addr = 0x0 }}, intr_handle = { { vfio_dev_fd = 62, uio_cfg_fd = 62 }, fd = 63, type = RTE_INTR_HANDLE_VFIO_MSIX, max_intr = 0, ---Type <return> to continue, or q <return> to quit--- nb_efd = 0, efd_counter_size = 0 '\000', efds = {0 <repeats 512 times>}, elist = {{ status = 0, fd = 0, epfd = 0, epdata = { event = 0, data = 0x0, cb_fun = 0x0, cb_arg = 0x0 } } <repeats 512 times>}, intr_vec = 0x0 }, driver = 0xe231e0 <rte_hinic_pmd>, max_vfs = 0, kdrv = RTE_KDRV_VFIO, name = "0000:05:00.0\000\000\000\000\000", vfio_req_intr_handle = { { vfio_dev_fd = 62, uio_cfg_fd = 62 }, fd = 64, type = RTE_INTR_HANDLE_VFIO_REQ, max_intr = 0, nb_efd = 0, efd_counter_size = 0 '\000', efds = {0 <repeats 512 times>}, ---Type <return> to continue, or q <return> to quit--- elist = {{ status = 0, fd = 0, epfd = 0, epdata = { event = 0, data = 0x0, cb_fun = 0x0, cb_arg = 0x0 } } <repeats 512 times>}, intr_vec = 0x0 } } (gdb) (gdb) p *(pci_dev->intr_handle) Structure has no component named operator*. (gdb) p pci_dev->intr_handle) Junk after end of expression. (gdb) p pci_dev->intr_handle $3 = { { vfio_dev_fd = 62, uio_cfg_fd = 62 }, fd = 63, type = RTE_INTR_HANDLE_VFIO_MSIX, max_intr = 0, nb_efd = 0, efd_counter_size = 0 '\000', efds = {0 <repeats 512 times>}, elist = {{ status = 0, fd = 0, epfd = 0, epdata = { event = 0, data = 0x0, cb_fun = 0x0, cb_arg = 0x0 } } <repeats 512 times>}, intr_vec = 0x0 } (gdb)

[root@localhost ~]# lsof -d 63
COMMAND     PID USER   FD      TYPE             DEVICE SIZE/OFF   NODE NAME
master    10657 root   63u     unix 0xffff805fcbfb5e80      0t0 104560 socket
TestMallo 15885 root   63u  a_inode               0,13        0   8356 [eventfd]
[root@localhost ~]# lsof -d 62
COMMAND     PID USER   FD      TYPE             DEVICE SIZE/OFF   NODE NAME
master    10657 root   62u     unix 0xffff805fcbfb5a00      0t0 104559 public/showq
TestMallo 15885 root   62u  a_inode               0,13        0   8356 [vfio-device]
[root@localhost ~]# ps -elf | grep 10657
5 S root      10657      1  0  80   0 -   342 SyS_ep Aug25 ?        00:00:03 /usr/libexec/postfix/master -w
4 S postfix   10701  10657  0  80   0 -   345 SyS_ep Aug25 ?        00:00:00 qmgr -l -t unix -u
4 S postfix   14671  10657  0  80   0 -   344 SyS_ep 21:41 ?        00:00:00 pickup -l -t unix -u
0 S root      16472  16388  0  80   0 -  1730 pipe_w 22:16 pts/3    00:00:00 grep --color=auto 10657
[root@localhost ~]# ps -elf | grep 15885
4 t root      15885  15792  0  80   0 - 8390110 ptrace 22:04 pts/2  00:00:00 /data1/dpdk-19.11/demo/memzone/build/app/TestMalloc 3 -c 0xff
0 S root      16486  16388  0  80   0 -  1729 pipe_w 22:16 pts/3    00:00:00 grep --color=auto 15885
[root@localhost ~]#