- check CPU info for huge page support
# whether supporting 2MB hugepage
cat /proc/cpuinfo |grep -i pse
# whether supporting 1GB hugepage
cat /proc/cpuinfo |grep -i pdpe1gb
- download dpdk and pktgen
# http://dpdk.org
sudo apt-get install xz-utils
tar xf dpdk-17.02.1.tar.xz
tar xvfz pktgen-3.3.2.tar.gz
- install build tools
sudo apt-get install make gcc
- build dpdk
make install T=x86_64-native-linuxapp-gcc DESTDIR=/usr/local
- configure environment variables and add them to ~/.bashrc
export RTE_SDK=/usr/local/share/dpdk
export RTE_TARGET=x86_64-native-linuxapp-gcc
- configure boot parameter
# "hugepages=512" means 2MB x 512 = 1GB
sudo vi /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="hugepagesz=2MB hugepages=512 iommu=pt intel_iommu=on"
or
GRUB_CMDLINE_LINUX_DEFAULT="hugepagesz=1G hugepages=1 iommu=pt intel_iommu=on"
sudo update-grub
sudo sync;sync;reboot
if you won’t use direct-IO in VM, you don’t need two iommu options above.
alternative method in case of installing with Ubuntu dpdk package
You can edit /etc/dpdk/dpdk.conf to reserve hugepage instead of above steps
NR_2M_PAGES=256
You can let your VM to have hugepage by adding this line to /etc/sysctl.conf
vm.nr_hugepages=256
- load kernel module
sudo modprobe uio
sudo modprobe uio_pci_generic
or
sudo insmod /usr/local/lib/modules/$(uname -r)/extra/dpdk/igb_uio.ko
according to your NIC model, you should choose a proper driver module
- test DPDK installation, for example
sudo su -
dpdk-devbind --bind=igb_uio eth2
dpdk-devbind --bind=igb_uio eth4
cd /usr/local/share/dpdk/examples/helloworld
make
cd build/app
./helloworld -c 0xc -n 4
- Additional Notes
in case of no /dev/hugepage, add this line to /etc/fstab and make a mount dir.
sudo mkdir /mnt/huge
sudo vi /etc/fstab
nodev /mnt/huge hugetlbfs defaults 0 0
check errors when a device cannot be used with IOMMU errors.
dmesg | grep -e DMAR -e IOMMU
if there is RMRR issue regarding IOMMU error, refer to http://dpdk.org/ml/archives/dev/2015-March/015504.html.
– add intel_iommu=off to GRUB_CMDLINE_DEFAULT in /etc/default/grub
– or, turn off RMRR option slot-by-slot in BIOS menu