From: Jason Gunthorpe <jgg@ziepe.ca>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Peter Xu <peterx@redhat.com>, John Hubbard <jhubbard@nvidia.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
cohuck@redhat.com, cai@lca.pw,
Andrea Arcangeli <aarcange@redhat.com>
Subject: Re: [PATCH v3 3/3] vfio-pci: Invalidate mmaps and block MMIO access on disabled memory
Date: Tue, 26 May 2020 12:53:31 -0300 [thread overview]
Message-ID: <20200526155331.GN744@ziepe.ca> (raw)
In-Reply-To: <20200526083218.40402f01@x1.home>
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
next prev parent reply other threads:[~2020-05-26 15:53 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-22 19:17 [PATCH v3 0/3] vfio-pci: Block user access to disabled device MMIO Alex Williamson
2020-05-22 19:17 ` [PATCH v3 1/3] vfio/type1: Support faulting PFNMAP vmas Alex Williamson
2020-05-22 19:17 ` [PATCH v3 2/3] vfio-pci: Fault mmaps to enable vma tracking Alex Williamson
2020-05-22 19:17 ` [PATCH v3 3/3] vfio-pci: Invalidate mmaps and block MMIO access on disabled memory Alex Williamson
2020-05-23 19:34 ` Peter Xu
2020-05-23 23:06 ` Alex Williamson
2020-05-23 23:52 ` Peter Xu
2020-05-24 0:02 ` Peter Xu
2020-05-25 12:26 ` Jason Gunthorpe
2020-05-25 14:28 ` Peter Xu
2020-05-25 14:46 ` Jason Gunthorpe
2020-05-25 15:11 ` Peter Xu
2020-05-25 16:56 ` Jason Gunthorpe
2020-05-25 20:56 ` John Hubbard
2020-05-26 0:37 ` Jason Gunthorpe
2020-05-26 0:46 ` John Hubbard
2020-05-26 13:49 ` Peter Xu
2020-05-26 14:32 ` Alex Williamson
2020-05-26 14:46 ` Peter Xu
2020-05-26 15:53 ` Jason Gunthorpe [this message]
2020-05-26 15:57 ` Alex Williamson
2020-05-22 22:08 ` [PATCH v3 0/3] vfio-pci: Block user access to disabled device MMIO Qian Cai
2020-05-22 22:25 ` Alex Williamson
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=20200526155331.GN744@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=aarcange@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=cai@lca.pw \
--cc=cohuck@redhat.com \
--cc=jhubbard@nvidia.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterx@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).