Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jason Gunthorpe" <jgg@nvidia.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v3 07/11] vfio: selftests: Allow drivers to specify required region size
Date: Fri, 17 Jul 2026 17:04:00 +0000	[thread overview]
Message-ID: <20260717170401.21AF51F000E9@smtp.kernel.org> (raw)
In-Reply-To: <7-v3-76f117ad04f1+28a90-mlx5st_jgg@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The computed driver region size uses `getpagesize()` as the minimum instead of `SZ_2M`, contradicting the commit message and altering test behavior.
--

--- Patch [7]: [PATCH v3 07/11] vfio: selftests: Allow drivers to specify required region size ---
commit 1aaddaa801402ac0c163d72d8dfe6ba18a6b7295
Author: Jason Gunthorpe <jgg@ziepe.ca>

vfio: selftests: Allow drivers to specify required region size

Add a region_size field to struct vfio_pci_driver_ops to let drivers
declare their DMA-mapped region size requirements. The core code will
round up and minimize the size to avoid changing test behavior.

> diff --git a/tools/testing/selftests/vfio/lib/vfio_pci_driver.c b/tools/testing/selftests/vfio/lib/vfio_pci_driver.c
> index 6827f4a6febe9..e13bbb7ee423d 100644
> --- a/tools/testing/selftests/vfio/lib/vfio_pci_driver.c
> +++ b/tools/testing/selftests/vfio/lib/vfio_pci_driver.c

[ ... ]

> @@ -28,6 +30,11 @@ void vfio_pci_driver_probe(struct vfio_pci_device *device)
>  			continue;
>  
>  		device->driver.ops = ops;
> +
> +		VFIO_ASSERT_NE(ops->region_size, 0);
> +		device->driver.region.size =
> +			max_t(u64, roundup_pow_of_two(ops->region_size),
> +			      getpagesize());

[Severity: Medium]
The commit message mentions that the core code will "minimize it to SZ_2M
so as not to change any test behavior."

Does this code in vfio_pci_driver_probe() compute the minimum size correctly
by using getpagesize() instead of SZ_2M? This appears to shrink the allocated
DMA region size for existing test drivers down to the page size, which might
alter the test behavior the commit message intended to preserve.

>  	}
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/0-v3-76f117ad04f1+28a90-mlx5st_jgg@nvidia.com?part=7

  reply	other threads:[~2026-07-17 17:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16 17:03 [PATCH v3 00/11] mlx5 support for VFIO self test Jason Gunthorpe
2026-07-16 17:03 ` [PATCH v3 01/11] net/mlx5: Add IFC structures for CQE and WQE Jason Gunthorpe
2026-07-16 17:03 ` [PATCH v3 02/11] net/mlx5: Move HW constant groups from device.h/cq.h to mlx5_ifc.h Jason Gunthorpe
2026-07-16 17:03 ` [PATCH v3 03/11] net/mlx5: Extract MLX5_SET/GET macros into mlx5_ifc_macros.h Jason Gunthorpe
2026-07-16 17:03 ` [PATCH v3 04/11] net/mlx5: Add ONCE and MMIO accessor variants to mlx5_ifc_macros.h Jason Gunthorpe
2026-07-16 17:03 ` [PATCH v3 05/11] selftests: Add additional kernel functions to tools/include/ Jason Gunthorpe
2026-07-16 17:03 ` [PATCH v3 06/11] selftests: Fix arm64 IO barriers to match kernel Jason Gunthorpe
2026-07-16 23:22   ` Nathan Chancellor
2026-07-17  0:36     ` Jason Gunthorpe
2026-07-16 17:03 ` [PATCH v3 07/11] vfio: selftests: Allow drivers to specify required region size Jason Gunthorpe
2026-07-17 17:04   ` sashiko-bot [this message]
2026-07-16 17:03 ` [PATCH v3 08/11] vfio: selftests: Add dev_dbg Jason Gunthorpe
2026-07-16 17:03 ` [PATCH v3 09/11] vfio: selftests: Add mlx5 driver - HW init and command interface Jason Gunthorpe
2026-07-17 17:04   ` sashiko-bot
2026-07-17 17:41     ` Jason Gunthorpe
2026-07-16 17:03 ` [PATCH v3 10/11] vfio: selftests: Add mlx5 driver - data path and memcpy ops Jason Gunthorpe
2026-07-16 17:03 ` [PATCH v3 11/11] 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=20260717170401.21AF51F000E9@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