kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Matlack <dmatlack@google.com>
To: Peter Xu <peterx@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	kvm list <kvm@vger.kernel.org>,
	 Sean Christopherson <seanjc@google.com>,
	James Houghton <jthoughton@google.com>,
	 Oliver Upton <oupton@google.com>,
	Axel Rasmussen <axelrasmussen@google.com>,
	 Mike Kravetz <mike.kravetz@oracle.com>,
	Andrea Arcangeli <aarcange@redhat.com>
Subject: Re: RFC: A KVM-specific alternative to UserfaultFD
Date: Thu, 9 Nov 2023 08:41:33 -0800	[thread overview]
Message-ID: <CALzav=d_ZyNGmh0086c8D+arjb6NPABEuOGL=aj3DzhKJ12Vmw@mail.gmail.com> (raw)
In-Reply-To: <ZUq6LJ+YppFlf43f@x1n>

On Tue, Nov 7, 2023 at 2:29 PM Peter Xu <peterx@redhat.com> wrote:
> On Tue, Nov 07, 2023 at 05:25:06PM +0100, Paolo Bonzini wrote:
> > On 11/6/23 21:23, Peter Xu wrote:
> > > On Mon, Nov 06, 2023 at 10:25:13AM -0800, David Matlack wrote:
> > >
> >
> > Once you have the implementation done for guest_memfd, it is interesting to
> > see how easily it extends to other, userspace-mappable kinds of memory.  But
> > I still dislike the fact that you need some kind of extra protocol in
> > userspace, for multi-process VMMs.  This is the kind of thing that the
> > kernel is supposed to facilitate.  I'd like it to do _more_ of that (see
> > above memfd pseudo-suggestion), not less.
>
> Is that our future plan to extend gmemfd to normal memories?
>
> I see that gmemfd manages folio on its own.  I think it'll make perfect
> sense if it's for use in CoCo context, where the memory is so special to be
> generic anyway.
>
> However if to extend it to generic memories, I'm wondering how do we
> support existing memory features of such memory which already exist with
> KVM_SET_USER_MEMORY_REGION v1.  To name some:
>
>   - numa awareness
>   - swapping
>   - cgroup
>   - punch hole (in a huge page, aka, thp split)
>   - cma allocations for huge pages / page migrations
>   - ...

Sean has stated that he doesn't want guest_memfd to support swap. So I
don't think guest_memfd will one day replace all guest memory
use-cases. That also means that my idea to extend my proposal to
guest_memfd VMAs has limited value. VMs that do not use guest_memfd
would not be able to use it.

Paolo, it sounds like overall my proposal has limited value outside of
GCE's use-case. And even if it landed upstream, it would bifrucate KVM
VM post-copy support. So I think it's probably not worth pursuing
further. Do you think that's a fair assessment? Getting a clear NACK
on pushing this proposal upstream would be a nice outcome here since
it helps inform our next steps.

That being said, we still don't have an upstream solution for 1G
post-copy, which James pointed out is really the core issue. But there
are other avenues we can explore in that direction such as cleaning up
HugeTLB (very nebulous) or adding 1G+mmap()+userfaultfd support to
guest_memfd. The latter seems promising.

  reply	other threads:[~2023-11-09 16:42 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06 18:25 RFC: A KVM-specific alternative to UserfaultFD David Matlack
2023-11-06 20:23 ` Peter Xu
2023-11-06 22:24   ` Axel Rasmussen
2023-11-06 23:03     ` Peter Xu
2023-11-06 23:22       ` David Matlack
2023-11-07 14:21         ` Peter Xu
2023-11-07 16:11           ` James Houghton
2023-11-07 17:24             ` Peter Xu
2023-11-07 19:08               ` James Houghton
2023-11-07 16:25   ` Paolo Bonzini
2023-11-07 20:04     ` David Matlack
2023-11-07 21:10       ` Oliver Upton
2023-11-07 21:34         ` David Matlack
2023-11-08  1:27           ` Oliver Upton
2023-11-08 16:56             ` David Matlack
2023-11-08 17:34               ` Peter Xu
2023-11-08 20:10                 ` Sean Christopherson
2023-11-08 20:36                   ` Peter Xu
2023-11-08 20:47                   ` Axel Rasmussen
2023-11-08 21:05                     ` David Matlack
2023-11-08 20:49                 ` David Matlack
2023-11-08 20:33               ` Paolo Bonzini
2023-11-08 20:43                 ` David Matlack
2023-11-07 22:29     ` Peter Xu
2023-11-09 16:41       ` David Matlack [this message]
2023-11-09 17:58         ` Sean Christopherson
2023-11-09 18:33           ` David Matlack
2023-11-09 22:44             ` David Matlack
2023-11-09 23:54               ` Sean Christopherson
2023-11-09 19:20           ` Peter Xu
2023-11-11 16:23             ` David Matlack
2023-11-11 17:30               ` Peter Xu
2023-11-13 16:43                 ` David Matlack
2023-11-20 18:32                   ` James Houghton

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='CALzav=d_ZyNGmh0086c8D+arjb6NPABEuOGL=aj3DzhKJ12Vmw@mail.gmail.com' \
    --to=dmatlack@google.com \
    --cc=aarcange@redhat.com \
    --cc=axelrasmussen@google.com \
    --cc=jthoughton@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=mike.kravetz@oracle.com \
    --cc=oupton@google.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=seanjc@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 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).