lkml.org 
[lkml]   [2020]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 3/3] vfio-pci: Invalidate mmaps and block MMIO access on disabled memory
On Tue, May 26, 2020 at 08:32:18AM -0600, Alex Williamson wrote:
> > > Certainly there is no reason to optimize the fringe case of vfio
> > > sleeping if there is and incorrect concurrnent attempt to disable the
> > > a BAR.
> >
> > If fixup_user_fault() (which is always with ALLOW_RETRY && !RETRY_NOWAIT) is
> > the only path for the new fault(), then current way seems ok. Not sure whether
> > this would worth a WARN_ON_ONCE(RETRY_NOWAIT) in the fault() to be clear of
> > that fact.
>
> Thanks for the discussion over the weekend folks. Peter, I take it
> you'd be satisfied if this patch were updated as:
>
> diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
> index aabba6439a5b..35bd7cd4e268 100644
> +++ b/drivers/vfio/pci/vfio_pci.c
> @@ -1528,6 +1528,13 @@ static vm_fault_t vfio_pci_mmap_fault(struct vm_fault *vmf)
> struct vfio_pci_device *vdev = vma->vm_private_data;
> vm_fault_t ret = VM_FAULT_NOPAGE;
>
> + /*
> + * We don't expect to be called with NOWAIT and there are conflicting
> + * opinions on whether NOWAIT suggests we shouldn't wait for locks or
> + * just shouldn't wait for I/O.
> + */
> + WARN_ON_ONCE(vmf->flags & FAULT_FLAG_RETRY_NOWAIT);

I don't think this is right, this implies there is some reason this
code fails with FAULT_FLAG_RETRY_NOWAIT - but it is fine as written,
AFAICT

Jason

\
 
 \ /
  Last update: 2020-05-26 17:53    [W:0.170 / U:0.764 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site