On Mon, May 26, 2025 at 10:15 AM Jason Gunthorpe jgg@nvidia.com wrote:
On Fri, May 23, 2025 at 11:29:52PM +0000, David Matlack wrote:
From: Josh Hilke jrhilke@google.com
Add a command line arg to vfio_dma_mapping_test to choose the size of page which is mapped in VFIO.
This doesn't seem right..
Tests should run automously, test all possible sizes using a fixture.
This test uses a fixture already. I assume you're referring to FIXTURE_VARIANT()?
I'll explore doing this. For a single dimension this looks possible. But for multiple dimensions (e.g. cross product of iommu_mode and backing_src) I don't see a clear way to do it. But that's just after a cursory look.
For context, the pattern of passing in test configuration via flags rather than automatically testing all combinations is something inherited from KVM selftests. That's the common pattern there. There's some work happening there to encode configurations at a higher level using testcase files and a runner [1].
There are also some challenges with making VFIO selftests (or any selftest that uses tools/testing/selftests/vfio/lib) truly autonomous:
- The library needs to know which device to use. In this RFC that works by the user passing in BDF as a positional argument to each test. - For tests that use HugeTLB (like this one), the test requires the user to have already allocated HugeTLB memory for it to use.
One idea would be to have tests test all possible iommu_modes by default (with the ability to override and pick a specific mode) and then let everything else be driven by flags.
[1] https://lore.kernel.org/kvm/20250222005943.3348627-1-vipinsh@google.com/