From: sashiko-bot@kernel.org
To: "Aaron Lewis" <aaronlewis@google.com>, kvm@vger.kernel.org
Subject: Re: [PATCH v4 5/5] vfio: selftests: Allow a size for vfio_dma_mapping_perf_test
Date: Sat, 14 Nov 2026 13:29:46 +0000 [thread overview]
Message-ID: <sashiko-outbox-214571@kernel.org> (raw)
In-Reply-To: <20261114132200.113697-6-aaronlewis@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] vfio: selftests: non-power-of-2 -b size aborts in
iova_allocator_alloc()
--
commit 7eb32375cc90a8bc43da0741f8174df52036eeb6
Author: Aaron Lewis <aaronlewis@google.com>
vfio: selftests: Allow a size for vfio_dma_mapping_perf_test
This commit adds a '-b' command-line option to vfio_dma_mapping_perf_test to
allow specifying the DMA region size to map and unmap.
> diff --git a/tools/testing/selftests/vfio/vfio_dma_mapping_perf_test.c b/tools/testing/selftests/vfio/vfio_dma_mapping_perf_test.c
> index 086a63a50df80..6e38cc134a49c 100644
> --- a/tools/testing/selftests/vfio/vfio_dma_mapping_perf_test.c
> +++ b/tools/testing/selftests/vfio/vfio_dma_mapping_perf_test.c
[ ... ]
> @@ -58,11 +136,16 @@ FIXTURE_TEARDOWN(vfio_dma_mapping_perf_test)
>
> TEST_F(vfio_dma_mapping_perf_test, dma_map_unmap)
> {
> - const u64 size = SZ_1G;
> + const u64 page_size = variant->page_size ?: getpagesize();
> + const u64 size = test_params.size;
> const int flags = variant->mmap_flags;
> struct dma_region region;
>
> - ksft_print_msg("mmap size = %lluG\n", (unsigned long long)(size / SZ_1G));
> + if (!IS_ALIGNED(size, page_size))
> + SKIP(return, "Size 0x%llx is not aligned to page size 0x%llx",
> + (unsigned long long)size, (unsigned long long)page_size);
> +
> + ksft_print_msg("mmap size = %s\n", test_params.size_str);
>
> TIME("mmap",
> region.vaddr = mmap(NULL, size, PROT_READ | PROT_WRITE, flags, -1, 0));
[Severity: Low]
Will passing a non-power-of-2 size such as "-b 3G" abort the test inside
iova_allocator_alloc()?
parse_size() accepts any positive multiplier and both dma_map_unmap and
dma_map_unmap_from_file only check IS_ALIGNED(size, page_size), but after
populating the mapping they pass size directly to iova_allocator_alloc(),
which requires a power of two:
tools/testing/selftests/vfio/lib/iova_allocator.c:iova_allocator_alloc() {
VFIO_ASSERT_GT(size, 0, "Invalid size arg, zero\n");
VFIO_ASSERT_EQ(size & (size - 1), 0, "Invalid size arg, non-power-of-2\n");
...
}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261114132200.113697-1-aaronlewis@google.com?part=5
prev parent reply other threads:[~2026-11-14 13:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 13:21 [PATCH v4 0/5] Introduce vfio_dma_mapping_perf_test Aaron Lewis
2026-11-14 13:21 ` [PATCH v4 1/5] vfio: selftests: Assert the region was unmapped in iommu_unmap() Aaron Lewis
2026-11-14 13:21 ` [PATCH v4 2/5] vfio: selftests: Introduce vfio_dma_mapping_perf_test Aaron Lewis
2026-11-14 13:21 ` [PATCH v4 3/5] vfio: selftests: Add memfd test to vfio_dma_mapping_perf_test Aaron Lewis
2026-11-14 13:21 ` [PATCH v4 4/5] selftests: harness: Support custom command-line options Aaron Lewis
2026-11-14 13:22 ` [PATCH v4 5/5] vfio: selftests: Allow a size for vfio_dma_mapping_perf_test Aaron Lewis
2026-11-14 13:29 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-214571@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=aaronlewis@google.com \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.