Re: [PATCH v4.14.y 2/3] vfio-pci: Fault mmaps to enable vma tracking

From: Greg KH
Date: Tue Sep 08 2020 - 13:17:09 EST


On Tue, Sep 08, 2020 at 01:47:06AM +0530, Ajay Kaher wrote:
> From: Alex Williamson <alex.williamson@xxxxxxxxxx>
>
> commit 11c4cd07ba111a09f49625f9e4c851d83daf0a22 upstream.
>
> Rather than calling remap_pfn_range() when a region is mmap'd, setup
> a vm_ops handler to support dynamic faulting of the range on access.
> This allows us to manage a list of vmas actively mapping the area that
> we can later use to invalidate those mappings. The open callback
> invalidates the vma range so that all tracking is inserted in the
> fault handler and removed in the close handler.
>
> Reviewed-by: Peter Xu <peterx@xxxxxxxxxx>
> Signed-off-by: Alex Williamson <alex.williamson@xxxxxxxxxx>
> [Ajay: Regenerated the patch for v4.14]
> Signed-off-by: Ajay Kaher <akaher@xxxxxxxxxx>
> ---
> drivers/vfio/pci/vfio_pci.c | 75 ++++++++++++++++++++++++++++++++++++-
> drivers/vfio/pci/vfio_pci_private.h | 7 ++++
> 2 files changed, 80 insertions(+), 2 deletions(-)

Oops, nope, this patch breaks the build:

drivers/vfio/pci/vfio_pci.c:1183:11: error: initialization of \u2018int (*)(struct vm_fault *)\u2019 from incompatible pointer type \u2018int (*)(struct vm_area_struct *, struct vm_fault *)\u2019 [-Werror=incompatible-pointer-types]
1183 | .fault = vfio_pci_mmap_fault,
| ^~~~~~~~~~~~~~~~~~~
drivers/vfio/pci/vfio_pci.c:1183:11: note: (near initialization for \u2018vfio_pci_mmap_ops.fault\u2019)
cc1: some warnings being treated as errors

Did you test this?

Please fix up and resend the whole series for 4.14.y

thanks,

greg k-h