Open
Conversation
Make it easier to build the tests by adding a Makefile. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
vfio-correct-ness-tests and vfio-huge-guest-test use mkstemp() without including stdlib.h where it is defined. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Ignore editor backups and the generate test programs. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This test program does an fwrite() direct from mmio space. This will print garbage, which is no real problem. What might be a problem though is that this fwrite() essential amounts to a memcpy() from the mmio space to stdio's internal buffer. Since it expects to be coming from regular memory, that may be optimized to use exotic load and store instructions (e.g. using vector registers). The effects of using those on mmio space might be strange - it can result in SIGILLs, or even crashes depending on details. To avoid that, use a simpler plain loop to read the IO space out byte by byte, with a volatile qualifier to discourage the compiler from doing anything too clever. Minor tweak of an earlier fix from Pradipta Banerjee <pradipta.banerjee@gmail.com>. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
1. Currently this attempts to map 1GiB into the IOMMU, in 4kiB chunks, which will exhaust the type1 kernel driver's default limit of 65535 mappings. Reduce the default mapping size to match the default kernel limit. 2. The chunk size is fixed to 4kiB, which will fail on platforms which don't have a 4kiB page size. Use getpagesize() instead (this can still fail if the IOMMU granularity doesn't match the system page size, but that's much rarer). 3. Currently the program loops forever, mapping and unmapping. Great for a stress test, not great for quickly seeing if things are working. Put in a maximum number of iterations (default 10). Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
awilliam
pushed a commit
that referenced
this pull request
Jun 26, 2025
pfnmap DMA mapping race test, new Makefile, mmap align fixes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi Alex, I realize this repo hasn't been much touched in years, but I'm using some of these tests while working on SR-IOV with Kata, so I thought I might as well push these fixes back.
The main thing here is a slightly polished version of Pradipta's fix (bpradipt@d884a0c) with an actual commit message with rationale. While I was doing that, I did some other trivial quality-of-life cleanups.