kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Upton <oliver.upton@linux.dev>
To: David Matlack <dmatlack@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, Peter Xu <peterx@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: Tue, 7 Nov 2023 21:10:40 +0000	[thread overview]
Message-ID: <ZUqn0OwtNR19PDve@linux.dev> (raw)
In-Reply-To: <CALzav=ejfDDRdjtx-ipFYrhNWPZnj3P0RSNHOQCP+OQf5YGX5w@mail.gmail.com>

On Tue, Nov 07, 2023 at 12:04:21PM -0800, David Matlack wrote:
> On Tue, Nov 7, 2023 at 8:25 AM Paolo Bonzini <pbonzini@redhat.com> wrote:

[...]

> >  My
> > gut feeling even without reading everything was (and it was confirmed
> > after): I am open to merging some specific features that close holes in
> > the userfaultfd API, but in general I like the unification between
> > guest, userspace *and kernel* accesses that userfaultfd brings. The fact
> > that it includes VGIC on Arm is a cherry on top. :)
> 
> Can you explain how VGIC interacts with UFFD? I'd like to understand
> if/how that could work with a KVM-specific solution.

The VGIC implementation is completely unaware of the existence of UFFD,
which is rather elegant.

There is no ioctl that allows userspace to directly get/set the VGIC
state. Instead, when userspace wants to migrate a VM it needs to flush
the cached state out of KVM's representation into guest memory. I would
expect the VMM to do this right before collecting the final dirty
bitmap.

If UFFD is off the table then it would appear there are two options:

 - Instrument these ioctls to request pages not marked as present in the
   theorized KVM-owned demand paging interface

 - Mandate that userspace has transferred all of the required VGIC / ITS
   pages before resuming on the target

The former increases the maintenance burden of supporting post-copy
upstream and the latter *will* fail spectacularly. Ideally we use a
mechanism that doesn't require us to think about instrumenting
post-copy for every new widget that we will want to virtualize.

> So in the short term we could provide a partial solution for
> HugeTLB-backed VMs (at least unblocking Google's use-case) and in the
> long-term there's line of sight of a unified solution.

Who do we expect to look after the upstreamed short-term solution once
Google has moved on to something else?

-- 
Thanks,
Oliver

  reply	other threads:[~2023-11-07 21:10 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 [this message]
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
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=ZUqn0OwtNR19PDve@linux.dev \
    --to=oliver.upton@linux.dev \
    --cc=aarcange@redhat.com \
    --cc=axelrasmussen@google.com \
    --cc=dmatlack@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).