Skip to content

Introduce vfio_dma_mapping_perf_test

Aaron Lewis kvm linux-kselftest 4 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest5 patches 0 repliesNew
  2. v34 patches 4 repliesSuperseded
  3. v24 patches 5 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v14 patches7 repliesSuperseded

Changes in v4 from the cover letter

- Split kselftest_harness.h custom CLI option support into its own patch
- Printed usage help on invalid options and passed custom optstring to test_enabled()
- Skipped variants when the '-b' size is not aligned to the page size
- Renamed timer_start() to timer_get()

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5vfio: selftests: Assert the region was unmapped in iommu_unmap()tools/testing/selftests/vfio/lib/include/libvfio/iommu.h tools/testing/selftests/vfio/vfio_dma_mapping_test.c+6 -100 replies
2/5vfio: selftests: Introduce vfio_dma_mapping_perf_testtools/testing/selftests/vfio/Makefile tools/testing/selftests/vfio/lib/include/libvfio.h tools/testing/selftests/vfio/vfio_dma_mapping_perf_test.c+122 -00 replies
3/5vfio: selftests: Add memfd test to vfio_dma_mapping_perf_testtools/testing/selftests/vfio/lib/include/libvfio/iommu.h tools/testing/selftests/vfio/lib/iommu.c tools/testing/selftests/vfio/vfio_dma_mapping_perf_test.c+132 -00 replies
4/5selftests: harness: Support custom command-line optionstools/testing/selftests/kselftest_harness.h+94 -330 replies
5/5vfio: selftests: Allow a size for vfio_dma_mapping_perf_testtools/testing/selftests/vfio/vfio_dma_mapping_perf_test.c+117 -270 replies

Reviews trailers per patch

3 of 5 patches have a Reviewed-by or Acked-by.

PatchDavid Matlack
1/5R-b
2/5R-b
3/5R-b
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/5] Introduce vfio_dma_mapping_perf_test

Add a new VFIO selftest, vfio_dma_mapping_perf_test, to provide a configurable tool for measuring DMA mapping and unmapping latencies across backing memory types, IOMMU backends, and region sizes.

For example, running the test across various region sizes (backed by 1G HugeTLB pages) makes it easy to collect and compare latencies:

Map latency:

IOCTL | 1G | 4G | 32G | 128G
--------------------+----------+----------+----------+-----------

VFIO_IOMMU_MAP_DMA  |  0.39 ms |  1.38 ms | 11.62 ms |  46.54 ms
IOMMU_IOAS_MAP      |  0.58 ms |  2.27 ms | 18.08 ms |  73.49 ms
IOMMU_IOAS_MAP_FILE |  0.01 ms |  0.02 ms |  0.10 ms |   0.32 ms

Unmap latency:

IOCTL | 1G | 4G | 32G | 128G
--------------------+----------+----------+----------+-----------

VFIO_IOMMU_MAP_DMA  |  1.51 ms |  5.69 ms | 45.78 ms | 187.66 ms
IOMMU_IOAS_MAP      |  1.84 ms |  6.83 ms | 52.53 ms | 211.75 ms
IOMMU_IOAS_MAP_FILE |  1.78 ms |  6.74 ms | 61.26 ms | 213.70 ms

The numbers in the tables were collected on EMR.

Changes in v4:
- Split kselftest_harness.h custom CLI option support into its own patch
- Printed usage help on invalid options and passed custom optstring to test_enabled()
- Skipped variants when the '-b' size is not aligned to the page size
- Renamed timer_start() to timer_get()

v3: https://lore.kernel.org/kvm/[email protected]/

Aaron Lewis (5):
vfio: selftests: Assert the region was unmapped in iommu_unmap()
vfio: selftests: Introduce vfio_dma_mapping_perf_test
vfio: selftests: Add memfd test to vfio_dma_mapping_perf_test
selftests: harness: Support custom command-line options
vfio: selftests: Allow a size for vfio_dma_mapping_perf_test

 tools/testing/selftests/kselftest_harness.h   | 127 +++++---
 tools/testing/selftests/vfio/Makefile         |   1 +
 .../selftests/vfio/lib/include/libvfio.h      |  31 ++
 .../vfio/lib/include/libvfio/iommu.h          |  14 +-
 tools/testing/selftests/vfio/lib/iommu.c      |  24 ++
 .../vfio/vfio_dma_mapping_perf_test.c         | 279 ++++++++++++++++++
 .../selftests/vfio/vfio_dma_mapping_test.c    |  11 +-
 7 files changed, 444 insertions(+), 43 deletions(-)
 create mode 100644 tools/testing/selftests/vfio/vfio_dma_mapping_perf_test.c
Signature · 1 line
2.56.0.611.g1030f0b940-goog