kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/10] KVM: selftests: exercise userfaultfd minor faults
@ 2021-05-19 20:03 Axel Rasmussen
  2021-05-19 20:03 ` [PATCH v2 01/10] KVM: selftests: trivial comment/logging fixes Axel Rasmussen
                   ` (10 more replies)
  0 siblings, 11 replies; 32+ messages in thread
From: Axel Rasmussen @ 2021-05-19 20:03 UTC (permalink / raw)
  To: Aaron Lewis, Alexander Graf, Andrew Jones, Andrew Morton,
	Ben Gardon, Emanuele Giuseppe Esposito, Eric Auger, Jacob Xu,
	Makarand Sonare, Oliver Upton, Paolo Bonzini, Peter Xu,
	Shuah Khan, Yanan Wang
  Cc: kvm, linux-kernel, linux-kselftest, Axel Rasmussen

Base
====

These patches are based upon Andrew Morton's v5.13-rc1-mmots-2021-05-13-17-23
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/

Changelog
=========

v1->v2:
- Picked up Reviewed-by's.
- Change backing_src_is_shared() to check the flags, instead of the type. This
  makes it robust to adding new backing source types in the future.
- Add another commit which refactors setup_demand_paging() error handling.
- Print UFFD ioctl type once in setup_demand_paging, instead of on every page-in
  operation.
- Expand comment on why we use MFD_HUGETLB instead of MAP_HUGETLB.
- Reworded comment on addr_gpa2alias.
- Moved demand_paging_test.c timing calls outside of the if (), deduplicating
  them.
- Split trivial comment / logging fixups into a separate commit.
- Add another commit which prints a clarifying message on test skip.
- Split the commit allowing backing src_type to be modified in two.
- Split the commit adding the shmem backing type in two.
- Rebased onto v5.13-rc1-mmots-2021-05-13-17-23.

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 (10):
  KVM: selftests: trivial comment/logging fixes
  KVM: selftests: simplify setup_demand_paging error handling
  KVM: selftests: print a message when skipping KVM tests
  KVM: selftests: compute correct demand paging size
  KVM: selftests: allow different backing source types
  KVM: selftests: refactor vm_mem_backing_src_type flags
  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        | 175 +++++++++++-------
 .../testing/selftests/kvm/include/kvm_util.h  |   1 +
 .../testing/selftests/kvm/include/test_util.h |  12 ++
 tools/testing/selftests/kvm/lib/kvm_util.c    |  84 ++++++++-
 .../selftests/kvm/lib/kvm_util_internal.h     |   2 +
 tools/testing/selftests/kvm/lib/test_util.c   |  51 +++--
 6 files changed, 238 insertions(+), 87 deletions(-)

--
2.31.1.751.gd2f1c929bd-goog


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2021-05-26 18:31 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19 20:03 [PATCH v2 00/10] KVM: selftests: exercise userfaultfd minor faults Axel Rasmussen
2021-05-19 20:03 ` [PATCH v2 01/10] KVM: selftests: trivial comment/logging fixes Axel Rasmussen
2021-05-19 21:41   ` Ben Gardon
2021-05-19 20:03 ` [PATCH v2 02/10] KVM: selftests: simplify setup_demand_paging error handling Axel Rasmussen
2021-05-19 21:45   ` Ben Gardon
2021-05-19 22:14     ` Axel Rasmussen
2021-05-19 22:23       ` Ben Gardon
2021-05-24 13:25       ` Paolo Bonzini
2021-05-19 20:03 ` [PATCH v2 03/10] KVM: selftests: print a message when skipping KVM tests Axel Rasmussen
2021-05-19 21:49   ` Ben Gardon
2021-05-24 13:23     ` Paolo Bonzini
2021-05-19 20:03 ` [PATCH v2 04/10] KVM: selftests: compute correct demand paging size Axel Rasmussen
2021-05-19 21:51   ` Ben Gardon
2021-05-19 20:03 ` [PATCH v2 05/10] KVM: selftests: allow different backing source types Axel Rasmussen
2021-05-19 21:53   ` Ben Gardon
2021-05-19 20:03 ` [PATCH v2 06/10] KVM: selftests: refactor vm_mem_backing_src_type flags Axel Rasmussen
2021-05-19 22:02   ` Ben Gardon
2021-05-19 22:16     ` Axel Rasmussen
2021-05-19 22:25       ` Ben Gardon
2021-05-19 20:03 ` [PATCH v2 07/10] KVM: selftests: add shmem backing source type Axel Rasmussen
2021-05-19 22:03   ` Ben Gardon
2021-05-19 20:03 ` [PATCH v2 08/10] KVM: selftests: create alias mappings when using shared memory Axel Rasmussen
2021-05-25 23:49   ` David Matlack
2021-05-26 17:22     ` Axel Rasmussen
2021-05-26 18:31       ` Paolo Bonzini
2021-05-19 20:03 ` [PATCH v2 09/10] KVM: selftests: allow using UFFD minor faults for demand paging Axel Rasmussen
2021-05-19 22:20   ` Ben Gardon
2021-05-19 22:34     ` Axel Rasmussen
2021-05-24 13:36     ` Paolo Bonzini
2021-05-19 20:03 ` [PATCH v2 10/10] KVM: selftests: add shared hugetlbfs backing source type Axel Rasmussen
2021-05-19 22:22   ` Ben Gardon
2021-05-24 13:38 ` [PATCH v2 00/10] KVM: selftests: exercise userfaultfd minor faults Paolo Bonzini

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).