Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 4 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | mm: introduce vma flag VM_PGOFF_IS_PFNinclude/ | +6 | 0 replies | |
| 2/2 | vfio: avoid unnecessary pin memory when dma map io address spacedrivers/ drivers/ include/ | +62 | 0 replies |
Reviews trailers per patch
All 2 patches have a Reviewed-by or Acked-by.
| Patch | Guanghui Feng | Xunlei Pang |
|---|---|---|
| 1/2 | R-b | R-b |
| 2/2 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v1: vfio: avoid unnecessary pin memory when dma map io address space 0/2]
When user application call ioctl(VFIO_IOMMU_MAP_DMA) to map a dma address, the general handler 'vfio_pin_map_dma' attempts to pin the memory and then create the mapping in the iommu.
However, some mappings aren't backed by a struct page, for example an mmap'd MMIO range for our own or another device. In this scenario, a vma with flag VM_IO | VM_PFNMAP, the pin operation will fail. Moreover, the pin operation incurs a large overhead which will result in a longer startup time for the VM. We don't actually need a pin in this scenario.
To address this issue, we introduce a new DMA MAP flag 'VFIO_DMA_MAP_FLAG_MMIO_DONT_PIN' to skip the 'vfio_pin_pages_remote' operation in the DMA map process for mmio memory. Additionally, we add the 'VM_PGOFF_IS_PFN' flag for vfio_pci_mmap address, ensuring that we can directly obtain the pfn through vma->vm_pgoff.
This approach allows us to avoid unnecessary memory pinning operations, which would otherwise introduce additional overhead during DMA mapping.
In my tests, using vfio to pass through an 8-card AMD GPU which with a large bar size (128GB*8), the time mapping the 192GB*8 bar was reduced from about 50.79s to 1.57s.
Qinyun Tan (2):
mm: introduce vma flag VM_PGOFF_IS_PFN
vfio: avoid unnecessary pin memory when dma map io address space
drivers/vfio/pci/vfio_pci_core.c | 2 +- drivers/vfio/vfio_iommu_type1.c | 64 +++++++++++++++++++++++++------- include/linux/mm.h | 6 +++ include/uapi/linux/vfio.h | 11 ++++++ 4 files changed, 68 insertions(+), 15 deletions(-)
Signature · 1 line
2.43.5