All of lore.kernel.org
 help / color / mirror / Atom feed
From: Axel Rasmussen <axelrasmussen@google.com>
To: Aaron Lewis <aaronlewis@google.com>,
	Alexander Graf <graf@amazon.com>,
	Andrew Jones <drjones@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ben Gardon <bgardon@google.com>,
	Emanuele Giuseppe Esposito <eesposit@redhat.com>,
	Eric Auger <eric.auger@redhat.com>,
	Jacob Xu <jacobhxu@google.com>,
	Makarand Sonare <makarandsonare@google.com>,
	Oliver Upton <oupton@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>, Peter Xu <peterx@redhat.com>,
	Shuah Khan <shuah@kernel.org>,
	Yanan Wang <wangyanan55@huawei.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	Axel Rasmussen <axelrasmussen@google.com>
Subject: [PATCH 0/5] KVM: selftests: exercise userfaultfd minor faults
Date: Wed, 12 May 2021 14:44:57 -0700	[thread overview]
Message-ID: <20210512214502.2047008-1-axelrasmussen@google.com> (raw)

Base
====

These patches are based upon Andrew Morton's v5.13-rc1-mmots-2021-05-10-22-15
tag. This is because this series depends on:

- UFFD minor fault support for hugetlbfs (in v5.13-rc1) [1]
- UFFD minor fault support for shmem (in Andrew's tree) [2]

[1] https://lore.kernel.org/linux-fsdevel/20210301222728.176417-1-axelrasmussen@google.com/
[2] https://lore.kernel.org/patchwork/cover/1420967/

Overview
========

Minor fault handling is a new userfaultfd feature whose goal is generally to
improve performance. In particular, it is intended for use with demand paging.
There are more details in the cover letters for this new feature (linked above),
but at a high level the idea is that we think of these three phases of live
migration of a VM:

1. Precopy, where we copy "some" pages from the source to the target, while the
   VM is still running on the source machine.
2. Blackout, where execution stops on the source, and begins on the target.
3. Postcopy, where the VM is running on the target, some pages are already up
   to date, and others are not (because they weren't copied, or were modified
   after being copied).

During postcopy, the first time the guest touches memory, we intercept a minor
fault. Userspace checks whether or not the page is already up to date. If
needed, we copy the final version of the page from the soure machine. This
could be done with RDMA for example, to do it truly in place / with no copying.
At this point, all that's left is to setup PTEs for the guest: so we issue
UFFDIO_CONTINUE. No copying or page allocation needed.

Because of this use case, it's useful to exercise this as part of the demand
paging test. It lets us ensure the use case works correctly end-to-end, and also
gives us an in-tree way to profile the end-to-end flow for future performance
improvements.

Axel Rasmussen (5):
  KVM: selftests: allow different backing memory types for demand paging
  KVM: selftests: add shmem backing source type
  KVM: selftests: create alias mappings when using shared memory
  KVM: selftests: allow using UFFD minor faults for demand paging
  KVM: selftests: add shared hugetlbfs backing source type

 .../selftests/kvm/demand_paging_test.c        | 146 +++++++++++++-----
 .../testing/selftests/kvm/include/kvm_util.h  |   1 +
 .../testing/selftests/kvm/include/test_util.h |  11 ++
 tools/testing/selftests/kvm/lib/kvm_util.c    |  79 +++++++++-
 .../selftests/kvm/lib/kvm_util_internal.h     |   2 +
 tools/testing/selftests/kvm/lib/test_util.c   |  46 ++++--
 6 files changed, 222 insertions(+), 63 deletions(-)

--
2.31.1.607.g51e8a6a459-goog


             reply	other threads:[~2021-05-12 22:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-12 21:44 Axel Rasmussen [this message]
2021-05-12 21:44 ` [PATCH 1/5] KVM: selftests: allow different backing memory types for demand paging Axel Rasmussen
2021-05-13 21:32   ` Ben Gardon
2021-05-13 22:02     ` Axel Rasmussen
2021-05-12 21:44 ` [PATCH 2/5] KVM: selftests: add shmem backing source type Axel Rasmussen
2021-05-13 21:46   ` Ben Gardon
2021-05-12 21:45 ` [PATCH 3/5] KVM: selftests: create alias mappings when using shared memory Axel Rasmussen
2021-05-13 22:33   ` Ben Gardon
2021-05-12 21:45 ` [PATCH 4/5] KVM: selftests: allow using UFFD minor faults for demand paging Axel Rasmussen
2021-05-17 23:51   ` Ben Gardon
2021-05-18 18:17     ` Axel Rasmussen
2021-05-18 19:05       ` Ben Gardon
2021-05-12 21:45 ` [PATCH 5/5] KVM: selftests: add shared hugetlbfs backing source type Axel Rasmussen
2021-05-17 23:57   ` Ben Gardon

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=20210512214502.2047008-1-axelrasmussen@google.com \
    --to=axelrasmussen@google.com \
    --cc=aaronlewis@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=bgardon@google.com \
    --cc=drjones@redhat.com \
    --cc=eesposit@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=graf@amazon.com \
    --cc=jacobhxu@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=makarandsonare@google.com \
    --cc=oupton@google.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=shuah@kernel.org \
    --cc=wangyanan55@huawei.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.