All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/11] KVM: selftests: Add aarch64/page_fault_test
@ 2022-03-11  6:01 ` Ricardo Koller
  0 siblings, 0 replies; 42+ messages in thread
From: Ricardo Koller @ 2022-03-11  6:01 UTC (permalink / raw)
  To: kvm, kvmarm, drjones; +Cc: maz, bgardon, pbonzini, axelrasmussen

This series adds a new aarch64 selftest for testing stage 2 fault handling for
various combinations of guest accesses (e.g., write, S1PTW), backing sources
(e.g., anon), and types of faults (e.g., read on hugetlbfs with a hole, write
on a readonly memslot). Each test tries a different combination and then checks
that the access results in the right behavior (e.g., uffd faults with the right
address and write/read flag). Some interesting combinations are:

- loading an instruction leads to a stage 1 page-table-walk that misses on
  stage 2 because the backing memslot for the page table it not in host memory
  (a hole was punched right there) and the fault is handled using userfaultfd.
  The expected behavior is that this leads to a userfaultfd fault marked as a
  write. See commit c4ad98e4b72c ("KVM: arm64: Assume write fault on S1PTW
  permission fault on instruction fetch") for why that's a write.
- a cas (compare-and-swap) on a readonly memslot leads to a failed vcpu run.
- write-faulting on a memslot that's marked for userfaultfd handling and dirty
  logging should result in a uffd fault and having the respective bit set in
  the dirty log.

The first 6 commits of this series add library support. The first one adds a
new userfaultfd library (out of demand_paging_test.c). The next 3 add some
library functions to get the GPA of a PTE, and to get the fd of a backing
source. Commit 6 fixes a leaked fd when using shared backing stores. The last 5
commits add the new selftest, one type of test at a time. It first adds core
tests, then uffd, then dirty logging, then readonly memslots tests, and finally
combinations of the previous ones (like uffd and dirty logging at the same
time).

Ricardo Koller (11):
  KVM: selftests: Add a userfaultfd library
  KVM: selftests: Add vm_mem_region_get_src_fd library function
  KVM: selftests: aarch64: Add vm_get_pte_gpa library function
  KVM: selftests: Add vm_alloc_page_table_in_memslot library function
  KVM: selftests: aarch64: Export _virt_pg_map with a pt_memslot arg
  KVM: selftests: Add missing close and munmap in __vm_mem_region_delete
  KVM: selftests: aarch64: Add aarch64/page_fault_test
  KVM: selftests: aarch64: Add userfaultfd tests into page_fault_test
  KVM: selftests: aarch64: Add dirty logging tests into page_fault_test
  KVM: selftests: aarch64: Add readonly memslot tests into
    page_fault_test
  KVM: selftests: aarch64: Add mix of tests into page_fault_test

 tools/testing/selftests/kvm/Makefile          |    3 +-
 .../selftests/kvm/aarch64/page_fault_test.c   | 1461 +++++++++++++++++
 .../selftests/kvm/demand_paging_test.c        |  227 +--
 .../selftests/kvm/include/aarch64/processor.h |    5 +
 .../selftests/kvm/include/kvm_util_base.h     |    2 +
 .../selftests/kvm/include/userfaultfd_util.h  |   46 +
 .../selftests/kvm/lib/aarch64/processor.c     |   36 +-
 tools/testing/selftests/kvm/lib/kvm_util.c    |   37 +-
 .../selftests/kvm/lib/userfaultfd_util.c      |  196 +++
 9 files changed, 1805 insertions(+), 208 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/aarch64/page_fault_test.c
 create mode 100644 tools/testing/selftests/kvm/include/userfaultfd_util.h
 create mode 100644 tools/testing/selftests/kvm/lib/userfaultfd_util.c

-- 
2.35.1.723.g4982287a31-goog

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

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

end of thread, other threads:[~2022-03-21 19:33 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-11  6:01 [PATCH 00/11] KVM: selftests: Add aarch64/page_fault_test Ricardo Koller
2022-03-11  6:01 ` Ricardo Koller
2022-03-11  6:01 ` [PATCH 01/11] KVM: selftests: Add a userfaultfd library Ricardo Koller
2022-03-11  6:01   ` Ricardo Koller
2022-03-16 18:02   ` Ben Gardon
2022-03-16 18:02     ` Ben Gardon
2022-03-18 20:27     ` Ricardo Koller
2022-03-18 20:27       ` Ricardo Koller
2022-03-11  6:01 ` [PATCH 02/11] KVM: selftests: Add vm_mem_region_get_src_fd library function Ricardo Koller
2022-03-11  6:01   ` Ricardo Koller
2022-03-16 18:08   ` Ben Gardon
2022-03-16 18:08     ` Ben Gardon
2022-03-18 20:30     ` Ricardo Koller
2022-03-18 20:30       ` Ricardo Koller
2022-03-21 17:01       ` Ben Gardon
2022-03-21 17:01         ` Ben Gardon
2022-03-11  6:01 ` [PATCH 03/11] KVM: selftests: aarch64: Add vm_get_pte_gpa " Ricardo Koller
2022-03-11  6:01   ` Ricardo Koller
2022-03-11  6:02 ` [PATCH 04/11] KVM: selftests: Add vm_alloc_page_table_in_memslot " Ricardo Koller
2022-03-11  6:02   ` Ricardo Koller
2022-03-16 18:07   ` Ben Gardon
2022-03-16 18:07     ` Ben Gardon
2022-03-18 20:33     ` Ricardo Koller
2022-03-18 20:33       ` Ricardo Koller
2022-03-11  6:02 ` [PATCH 05/11] KVM: selftests: aarch64: Export _virt_pg_map with a pt_memslot arg Ricardo Koller
2022-03-11  6:02   ` Ricardo Koller
2022-03-11  6:02 ` [PATCH 06/11] KVM: selftests: Add missing close and munmap in __vm_mem_region_delete Ricardo Koller
2022-03-11  6:02   ` Ricardo Koller
2022-03-16 18:09   ` Ben Gardon
2022-03-16 18:09     ` Ben Gardon
2022-03-18 20:33     ` Ricardo Koller
2022-03-18 20:33       ` Ricardo Koller
2022-03-11  6:02 ` [PATCH 07/11] KVM: selftests: aarch64: Add aarch64/page_fault_test Ricardo Koller
2022-03-11  6:02   ` Ricardo Koller
2022-03-11  6:02 ` [PATCH 08/11] KVM: selftests: aarch64: Add userfaultfd tests into page_fault_test Ricardo Koller
2022-03-11  6:02   ` Ricardo Koller
2022-03-11  6:02 ` [PATCH 09/11] KVM: selftests: aarch64: Add dirty logging " Ricardo Koller
2022-03-11  6:02   ` Ricardo Koller
2022-03-11  6:02 ` [PATCH 10/11] KVM: selftests: aarch64: Add readonly memslot " Ricardo Koller
2022-03-11  6:02   ` Ricardo Koller
2022-03-11  6:02 ` [PATCH 11/11] KVM: selftests: aarch64: Add mix of " Ricardo Koller
2022-03-11  6:02   ` Ricardo Koller

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.