运行 DPDK 示例程序上的 EAL 初始化错误

EAL initialization error on running DPDK sample program

执行示例程序出现如下错误./basicfwd -c 1 -n 4 我已经设置了hugepages。

EAL: Detected 8 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Detected shared linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: No available 16777216 kB hugepages reported
EAL: 1024 hugepages of size 2097152 reserved, but no mounted hugetlbfs found for that size
EAL: No free 524288 kB hugepages reported on node 0
EAL: No available 524288 kB hugepages reported
EAL: FATAL: Cannot get hugepage information.
EAL: Cannot get hugepage information.
EAL: Error - exiting with code: 1
  Cause: Error with EAL initialization

请建议如何解决此错误。

根据日志,错误原因表述为 EAL: 1024 hugepages of size 2097152 reserved, but no mounted hugetlbfs found for that size。这意味着未安装 2MB 大页面。

有两种挂载大页面的方法

  1. 使用 dpdk 工具usertools/dpdk-hugepages.py --setup 1G
  2. 手动装载页面mount -t hugetlbfs hugetlbfs /path/to/hugepages2M -o pagesize=2M

这些都清楚地涵盖了getting started dpdk guide。因此,我要求请阅读并按照指南中的说明进行操作。