Re: [PATCH v3 00/10] Update vfio_pin/unpin_pages API

From: Alex Williamson
Date: Fri Jul 22 2022 - 20:18:14 EST


On Fri, 22 Jul 2022 16:12:19 -0700
Nicolin Chen <nicolinc@xxxxxxxxxx> wrote:

> On Fri, Jul 22, 2022 at 04:11:29PM -0600, Alex Williamson wrote:
>
> > GVT-g explodes for me with this series on my Broadwell test system,
> > continuously spewing the following:
>
> Thank you for running additional tests.
>
> > [ 47.348778] WARNING: CPU: 3 PID: 501 at drivers/vfio/vfio_iommu_type1.c:978 vfio_iommu_type1_unpin_pages+0x7b/0x100 [vfio_iommu_type1]
>
> > Line 978 is the WARN_ON(i != npage) line. For the cases where we don't
> > find a matching vfio_dma, I'm seeing addresses that look maybe like
> > we're shifting a value that's already an iova by PAGE_SHIFT somewhere.
>
> Hmm..I don't understand the PAGE_SHIFT part. Do you mind clarifying?

The iova was a very large address for a 4GB VM with a lot of zeros on
the low order bits, ex. 0x162459000000. Thanks,

Alex

> And GVT code initiated an unpin request from gvt_unpin_guest_pag()
> that is currently unpinning one page at a time on a contiguous IOVA
> range, prior to this series. After this series, it leaves the per-
> page routine to the internal loop of vfio_iommu_type1_unpin_pages(),
> which is supposed to do the same.
>
> So, either resulted from the npage input being wrong or some other
> factor weighed in that invoked a vfio_remove_dma on those iovas?
>
> Thanks
> Nic
>