Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: "David Matlack" <dmatlack@google.com>
To: <sashiko-reviews@lists.linux.dev>,
	"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: Wed, 25 Nov 2026 11:24:45 -0800	[thread overview]
Message-ID: <DN4JDERN99EE.2WKRR6CJ5R4OI@google.com> (raw)
In-Reply-To: <sashiko-outbox-214571@kernel.org>

On Sat Nov 14, 2026 at 5:29 AM PST, sashiko-bot wrote:
> [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");
>     ...
> }

This is a false positive. iova_allocator_alloc() no longer requires a
power-of-2 size. As of commit 53e5fe5f28df ("vfio: selftests: Allow
drivers to specify required region size"), which landed in v7.4-rc1, it
rounds the size up to the next power of 2:

	VFIO_ASSERT_LE(size, rounddown_pow_of_two(SIZE_MAX),
		       "Invalid size arg, too large (%zu)\n", size);
	size = roundup_pow_of_two(size);

It looks like this review was done against an older base commit.

  reply	other threads:[~2026-11-25 19:24 UTC|newest]

Thread overview: 10+ 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-25 19:40   ` David Matlack
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
2026-11-25 19:24     ` David Matlack [this message]
2026-11-25 19:56   ` David Matlack

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=DN4JDERN99EE.2WKRR6CJ5R4OI@google.com \
    --to=dmatlack@google.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox