dpdk内存篇1-基本 https://www.sdnlab.com/23475.html
https://software.intel.com/en-us/articles/memory-in-dpdk-part-1-general-concepts
dpdk内存篇2-深入IOVA https://www.sdnlab.com/23551.html
https://software.intel.com/en-us/articles/memory-in-dpdk-part-2-deep-dive-into-iova
dpdk内存3-dpdk 17.11及更早版本 https://software.intel.com/en-us/articles/memory-in-dpdk-part-3-1711-and-earlier-releases
dpdk内存4 -dpdk18.11之后 https://software.intel.com/en-us/articles/memory-in-dpdk-part-4-1811-and-beyond
general concepts
huge pages:
memory 以page为单位进行管理,page:virtually and physically continuous blocks of memory.
程序运行时,通过page address来访问memory。这个地址需要从应用所用的虚拟地址转换为hardware认识的物理地址。
转换过程通过page tables;最近使用的page address被放在cache中(TLB:translation lookaside buffer). 每个page占用TLB中的一个entry。
若你要访问的页不在TLB中,那么就是TLB miss。OS会从global page table中去找miss的这个页放到TLB中。这个过程比较expensive。
为了减少TLB miss,DPDK采用huge page:2MB或1GB的virtually and physically continuous memory area。
这样1个page可以覆盖更大的memory area,即每个TLB entry对应的memory area更大。这样会减少TLB miss。
pinning memory to NUMA node
hardware,physical address and DMA
IOMMU and IOVA
iova:
input-output virtual address
memory allocation and management
memory pools
deep dive into IOVA
iova
pci driver in DPDK
uio_pci_generic
kernel中的uio driver。比igb_uio的功能少:所支持的interrupt type只有legacy interrupt;不能创建virtual functions。
igb_uio
是dpdk最开始时候就设计的。
利用kernel的UIO framework,提供了对所有中断类型的支持(legacy,message signal interrupt[MSI],MSI-X), 以及创建virtual functions。
并把硬件设备的registers和interrupt handles 暴露到/dev/uio 文件系统下。这样DPDK EAL把它映射到user space,供给DPDK PMD使用。
igb_uio不支持IOMMU,只能用passthrough的方式,它在IOVA和physical address间的映射是1:1的。只能用IOVA as PA。
vfio-pci
是kernel中VFIO infrastructure 的一部分。
VFIO infrastructure使得设备registers 和设备interrupts 可以被user space应用程序使用,而且可以使用IOMMU建立IOVA mappings 来
从user space执行IO。
vfio-pci允许使用IOVA as PA(需要root权限)和IOVA as VA。
4.5之后的kernel引入enable_unsafe_noiommu_mode,使得vfio可以在没有IOMMU的情况使用。