All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>,
	"Zengtao (B)" <prime.zeng@hisilicon.com>,
	Cornelia Huck <cohuck@redhat.com>,
	Kevin Tian <kevin.tian@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Giovanni Cabiddu <giovanni.cabiddu@intel.com>,
	Michel Lespinasse <walken@google.com>,
	Jann Horn <jannh@google.com>, Max Gurtovoy <mgurtovoy@nvidia.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linuxarm <linuxarm@huawei.com>
Subject: Re: [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant
Date: Tue, 9 Mar 2021 14:43:01 -0700	[thread overview]
Message-ID: <20210309144301.3593af00@omen.home.shazbot.org> (raw)
In-Reply-To: <20210309210036.GJ763132@xz-x1>

On Tue, 9 Mar 2021 16:00:36 -0500
Peter Xu <peterx@redhat.com> wrote:

> On Tue, Mar 09, 2021 at 01:11:04PM -0700, Alex Williamson wrote:
> > > It's just that the initial MMIO access delay would be spread to the 1st access
> > > of each mmio page access rather than using the previous pre-fault scheme.  I
> > > think an userspace cares the delay enough should pre-fault all pages anyway,
> > > but just raise this up.  Otherwise looks sane.  
> > 
> > Yep, this is a concern.  Is it safe to have loops concurrently and fully
> > populating the same vma with vmf_insert_pfn()?  
> 
> AFAIU it's safe, and probably the (so far) best way for an userspace to quickly
> populate a huge chunk of mmap()ed region for either MMIO or RAM.  Indeed from
> that pov vmf_insert_pfn() seems to be even more efficient on prefaulting since
> it can be threaded.

Ok, then we'll keep the loop and expect that a race might incur
duplicate work, but should be safe.

It also occurred to me that Jason was suggesting the _prot version of
vmf_insert_pfn(), which I think is necessary if we want to keep the
same semantics where the default io_remap_pfn_range() was applying
pgprot_decrypted() onto vma->vm_page_prot.  So if we don't want to
break SME use cases we better apply that ourselves.  Thanks,

Alex


  reply	other threads:[~2021-03-09 21:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 11:11 [PATCH] vfio/pci: make the vfio_pci_mmap_fault reentrant Zeng Tao
2021-03-08 20:21 ` Alex Williamson
2021-03-08 22:56   ` Peter Xu
2021-03-09  3:49     ` 答复: " Zengtao (B)
2021-03-09 12:46       ` Jason Gunthorpe
2021-03-09 15:29         ` Alex Williamson
2021-03-09 16:40           ` Jason Gunthorpe
2021-03-09 18:47             ` Peter Xu
2021-03-09 19:26               ` Alex Williamson
2021-03-09 19:48                 ` Peter Xu
2021-03-09 20:11                   ` Alex Williamson
2021-03-09 21:00                     ` Peter Xu
2021-03-09 21:43                       ` Alex Williamson [this message]
2021-03-09 19:56                 ` Alex Williamson
2021-03-09 23:45                   ` Jason Gunthorpe
2021-03-10  6:23                     ` Alex Williamson
2021-03-09 23:41                 ` Jason Gunthorpe
2021-03-10  6:08                   ` Alex Williamson
2021-03-11  3:32                     ` 答复: " Zengtao (B)
2021-03-08 23:43   ` 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=20210309144301.3593af00@omen.home.shazbot.org \
    --to=alex.williamson@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=cohuck@redhat.com \
    --cc=giovanni.cabiddu@intel.com \
    --cc=jannh@google.com \
    --cc=jgg@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mgurtovoy@nvidia.com \
    --cc=peterx@redhat.com \
    --cc=prime.zeng@hisilicon.com \
    --cc=walken@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.