From: sashiko-bot@kernel.org
To: "Jason Gunthorpe" <jgg@nvidia.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v4 06/10] vfio: selftests: Allow drivers to specify required region size
Date: Thu, 13 Aug 2026 15:00:07 +0000 [thread overview]
Message-ID: <20260813150007.9ADE11F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <6-v4-021df3fb5a3f+98e-mlx5st_jgg@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The DMA region sizes provided by the driver ops are not page-aligned, causing the IOMMU mapping ioctls to fail with -EINVAL and crashing the selftests.
--
--- Patch [6]: [PATCH v4 06/10] vfio: selftests: Allow drivers to specify required region size ---
commit 4f2bbead708ec429c301f599e1115b9b6e4e3c22
Author: Jason Gunthorpe <jgg@ziepe.ca>
vfio: selftests: Allow drivers to specify required region size
This patch adds a region_size field to struct vfio_pci_driver_ops, allowing
drivers to declare their needed DMA-mapped region size. It replaces the
hardcoded SZ_2M value with the exact sizes of the drivers' state structures.
> diff --git a/tools/testing/selftests/vfio/vfio_pci_driver_test.c b/tools/testing/selftests/vfio/vfio_pci_driver_test.c
> index 761bf117d624f..2bd949aafd731 100644
> --- a/tools/testing/selftests/vfio/vfio_pci_driver_test.c
> +++ b/tools/testing/selftests/vfio/vfio_pci_driver_test.c
[ ... ]
> @@ -87,7 +87,8 @@ FIXTURE_SETUP(vfio_pci_driver_test)
> driver = &self->device->driver;
>
> region_setup(self->iommu, self->iova_allocator, &self->memcpy_region, SZ_1G);
> - region_setup(self->iommu, self->iova_allocator, &driver->region, SZ_2M);
> + region_setup(self->iommu, self->iova_allocator, &driver->region,
> + driver->region.size);
[Severity: Medium]
Since the drivers populate region_size with the exact struct size (such as
sizeof(struct dsa_state) or sizeof(struct igb)), will this cause IOMMU
mapping ioctls to fail?
IOMMU mapping ioctls generally require the requested DMA mapping length to be
an exact multiple of the minimum IOMMU page size. Passing this unaligned
size to region_setup() sets the region size to the unaligned value.
When iommu_map() later issues the VFIO_IOMMU_MAP_DMA or IOMMU_IOAS_MAP
ioctl, could the kernel reject the unaligned size with -EINVAL and crash
the test suite?
Does region_size need to be page-aligned before being used for DMA mappings?
--
Sashiko AI review · https://sashiko.dev/#/patchset/0-v4-021df3fb5a3f+98e-mlx5st_jgg@nvidia.com?part=6
next prev parent reply other threads:[~2026-08-13 15:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 14:58 [PATCH v4 00/10] mlx5 support for VFIO self test Jason Gunthorpe
2026-08-12 14:58 ` [PATCH v4 01/10] net/mlx5: Add IFC structures for CQE and WQE Jason Gunthorpe
2026-08-12 14:59 ` [PATCH v4 02/10] net/mlx5: Move HW constant groups from device.h/cq.h to mlx5_ifc.h Jason Gunthorpe
2026-08-12 14:59 ` [PATCH v4 03/10] net/mlx5: Extract MLX5_SET/GET macros into mlx5_ifc_macros.h Jason Gunthorpe
2026-08-13 15:00 ` sashiko-bot
2026-08-12 14:59 ` [PATCH v4 04/10] net/mlx5: Add ONCE and MMIO accessor variants to mlx5_ifc_macros.h Jason Gunthorpe
2026-08-12 14:59 ` [PATCH v4 05/10] selftests: Add additional kernel functions to tools/include/ Jason Gunthorpe
2026-08-12 14:59 ` [PATCH v4 06/10] vfio: selftests: Allow drivers to specify required region size Jason Gunthorpe
2026-08-12 22:11 ` David Matlack
2026-08-12 22:13 ` David Matlack
2026-08-12 23:44 ` Jason Gunthorpe
2026-08-13 15:00 ` sashiko-bot [this message]
2026-08-12 14:59 ` [PATCH v4 07/10] vfio: selftests: Add dev_dbg Jason Gunthorpe
2026-08-12 14:59 ` [PATCH v4 08/10] vfio: selftests: Add mlx5 driver - HW init and command interface Jason Gunthorpe
2026-08-12 21:41 ` David Matlack
2026-08-12 23:32 ` Jason Gunthorpe
2026-08-13 15:40 ` David Matlack
2026-08-13 15:00 ` sashiko-bot
2026-08-12 14:59 ` [PATCH v4 09/10] vfio: selftests: Add mlx5 driver - data path and memcpy ops Jason Gunthorpe
2026-08-13 15:00 ` sashiko-bot
2026-08-12 14:59 ` [PATCH v4 10/10] vfio: selftests: mlx5 driver - add send_msi support Jason Gunthorpe
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=20260813150007.9ADE11F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=jgg@nvidia.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