这是关于使用VM播放器运行的自定义linux中DPDK中的Helloworld程序。我已经在Ubuntu虚拟机中安装了DPDK19.11,并尝试了Hello world程序。我还分配了肩章并登上了/mnt/wigh。它运行良好。NIC驱动程序为e1000。
然后,我在自定义Linux发行版中使用相同的步骤安装了DPDK19.11。它不太好用。我注意到NIC驱动程序信息被提到为来自AMD的PCNET32(在自定义Linux创建中的某个地方可能会设置(。
因此,我使用rmmod命令删除PCNET32,并使用INSMOD命令加载e1000。
当我放入/sbin/lsmod|grep e1000时,我也得到了e1000条目。但是hello世界程序失败了,说
EAL: Detected 4 lcores
EAL: Detected 1 NUMA nodes
....
EAL: error allocating rte services array
EAL: FATAL rte_service_init() failed
EAL: rte_service_init() failed
PANIC in main
cannot init EAL
在insmod命令之后,当我将ethtool-I eth0放入它说无法获取驾驶员信息:没有这样的设备。早些时候,它曾显示PCNET32。现在,它应该以与Ubuntu相同的方式显示e1000。如果重新启动网络服务,则会再次显示PCNET32。
有人能帮助我理解这两件事并指导我解决这些问题吗?
编辑:这个例子来自DPDK helloworld。我已使用以下命令执行程序
/helloworld-l 0-3-n 1--无pci--loglevel=eal,8
日志内容
EAL: Probing VFIO support
EAL: IOMMU type 1 ( Type 1 ) is supported
EAL: IOMMU type 7 ( sPAPR ) is not supported
EAL: IOMMU type 8 (No-IOMMU ) is not supported
EAL: VFIO support initialized
EAL: Ask a virtual area of bytes
EAL: Virtual area found
EAL: Setting up physically contiguous memory
EAL: Setting Max no of open files to 4096
EAL: Detected memory type:scoket_id :0
EAL: Creating 4 segment lists
EAL: Ask a virtual area of bytes
EAL: Virtual area found at
EAL: Master lcore 0 is ready
EAL: lcore 3 is ready
EAL: lcore 1 is ready
EAL: lcore 2 is ready
EAL: NUMA is not supported
EAL: alloc_seg():get_mempolicy: Function not implemented
EAL: Ask a virtual area
EAL: Virtual area found
EAL: attempted to allocate 1 segments, but only 0 were allocated
EAL: error allocating rte services array
EAL: rte_service_init() failed
PANIC in main()
Cannot init EAL
5:[./helloworld(_start_ _]
4:[/lib/libc.so.6(_ _libc_start)
3:[./helloworld()
2:[./helloworld(__rte_panic)
1:[./helloworld(rte_dump_stack)
我用ldd helloworld命令进行了验证。利布努玛与helloworld联系在一起。
根据评论,我理解问题可能与NIC接口无关
insmod命令似乎不足以启用e1000驱动程序到NIC接口。
我还想了解如何在默认情况下或手动(使用insmod(使用任何接口启用像e1000这样的英特尔驱动程序,因为这是利用DPDK高性能所必需的。
我只是简单地从Ubuntu复制了DPDK的完整安装,在那里我构建了并用RTE_TARGET将helloworld制作成了自定义Linux。它适用于MySQL、Java、Tomcat。这会有什么问题吗?
如果你需要更多的细节,请告诉我。
编辑2:
我已经创建了巨大的页面,并在引导后使用以下步骤进行装载。
echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
mkdir /mnt/huge
mount -t hugetlbfs nodev /mnt/huge
请查找cat/proc/meminfo输出
Hugepages Total = 1024
Hugepages Free = 1024
Hugepages Rsvd = 0
Hugepages Surp = 0
Hugepage Size 2048.
但helloworld程序再次失败
这些步骤与我在Ubuntu中执行的步骤相同。它工作得很好。
然后我按照你建议的helloworld with --no-huge option
试了一下。它很好用。谢谢你的帮助
我可以知道hugepage设置中是否遗漏了任何步骤吗。如何使用hugepage功能?
另一种选择是使用不同版本的内核、glibc等构建linux,并与Ubuntuvm配置保持一致,以利用hugepage。
非常感谢你的建议。
编辑3:
在添加ethernet.virtualDev="0"之后;e1000";在vm的vmx文件中,默认情况下会启用intel e1000 NIC卡。
DPDK通常在标准Linux发行版(如Ubuntu/Fedro等(中编译和测试,因此不能保证它在您的自定义Linux机器中正常工作。此外,DPDK仅在我看不到AMD PCnet32接口的受支持硬件上起作用。与Intel e1000 NIC不同,受支持的NIC中提供了DPDK接口。虚拟模拟NIC或裸机本机NIC都应该由DPDK库支持,这是强制性的。其次,当你执行原始驱动程序的NIC rmmod和modprobe任何其他驱动程序时,你不能指望它能工作。
基于@vijay的实时调试,问题不在于DPDK库或DPDK构建,而在于所使用的环境。目标Linux的当前二进制文件不是通过跨工具链构建的。相反,Ubuntu被用来创建二进制文件并复制到目标。
请求对库使用DPDK交叉构建,对目标使用PMD。建议将标志用作
export RTE_SDK=[dpdk parent]
export RTE_TARGET=[dpdk target]
export SYSROOT=[path to toolchain sysroot]
export ARCH=[target architecutre]
export RTE_KERNELDIR=[path to toolchain linux]
export CROSS=$CROSS_COMPILE
export EXTRA_CFLAGS="--sysroot=$SDKTARGETSYSROOT"