]> Gentwo Git Trees - linux/.git/commit
vfio: selftests: Add vfio_pci_device_init_perf_test
authorDavid Matlack <dmatlack@google.com>
Wed, 26 Nov 2025 23:17:33 +0000 (23:17 +0000)
committerAlex Williamson <alex@shazbot.org>
Fri, 28 Nov 2025 17:58:07 +0000 (10:58 -0700)
commitd721f52e31553a848e0e9947ca15a49c5674aef3
tree73671ff31c42bd7b7df9a7bacd3f0efd8b7f14f3
parentb8e96c8805ec25878ac971cad34732a6aabe34f6
vfio: selftests: Add vfio_pci_device_init_perf_test

Add a new VFIO selftest for measuring the time it takes to run
vfio_pci_device_init() in parallel for one or more devices.

This test serves as manual regression test for the performance
improvement of commit e908f58b6beb ("vfio/pci: Separate SR-IOV VF
dev_set"). For example, when running this test with 64 VFs under the
same PF:

Before:

  $ ./vfio_pci_device_init_perf_test -r vfio_pci_device_init_perf_test.iommufd.init 0000:1a:00.0 0000:1a:00.1 ...
  ...
  Wall time: 6.653234463s
  Min init time (per device): 0.101215344s
  Max init time (per device): 6.652755941s
  Avg init time (per device): 3.377609608s

After:

  $ ./vfio_pci_device_init_perf_test -r vfio_pci_device_init_perf_test.iommufd.init 0000:1a:00.0 0000:1a:00.1 ...
  ...
  Wall time: 0.122978332s
  Min init time (per device): 0.108121915s
  Max init time (per device): 0.122762761s
  Avg init time (per device): 0.113816748s

This test does not make any assertions about performance, since any such
assertion is likely to be flaky due to system differences and random
noise. However this test can be fed into automation to detect
regressions, and can be used by developers in the future to measure
performance optimizations.

Suggested-by: Aaron Lewis <aaronlewis@google.com>
Reviewed-by: Alex Mastro <amastro@fb.com>
Tested-by: Alex Mastro <amastro@fb.com>
Reviewed-by: Raghavendra Rao Ananta <rananta@google.com>
Signed-off-by: David Matlack <dmatlack@google.com>
Link: https://lore.kernel.org/r/20251126231733.3302983-19-dmatlack@google.com
Signed-off-by: Alex Williamson <alex@shazbot.org>
tools/testing/selftests/vfio/Makefile
tools/testing/selftests/vfio/vfio_pci_device_init_perf_test.c [new file with mode: 0644]