Re: [PATCH 5/5] vfio-pci: Best-effort huge pfnmaps with !MAP_FIXED mappings

Alex Mastro
2025-06-13T17:48:38Z

Thank you Peter!

I packported this series to our 6.13.2 tree and validated that it does indeed
provide equivalent, optimal faulting to our manual alignment approach when we
mmap with !MAP_FIXED. This addresses the issue we discovered in [1].

The test case is performing mmap with offset=0x40006000000, size=0xdf9e00000,
and we see that the head and tail (975) are faulted at 2M, and middle (54) at
1G. The vma returned by mmap looks nice: 0x7f8646000000.

$ sudo bpftrace -q -e 'fexit:vfio_pci_mmap_huge_fault { printf("order=%d, ret=0x%x\n", args.order, retval); }' 2>&1 > ~/dump
$ cat ~/dump | sort | uniq -c | sort -nr
975 order=9, ret=0x100
54 order=18, ret=0x100
2 order=18, ret=0x800

[1] https://lore.kernel.org/linux-pci/20250529214414.1508155-1-amastro@fb.com/

Tested-by: Alex Mastro <amastro@fb.com>