diff options
author | Axel Rasmussen <axelrasmussen@google.com> | 2021-05-19 23:03:36 +0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-05-27 14:45:56 +0300 |
commit | c9befd5958fdf8913db69049d47b6ac1d970af03 (patch) | |
tree | 6528395627ddf31b80d55b981b2088e106ed3c4f /tools/testing/selftests/kvm/lib/test_util.c | |
parent | b3784bc28ccc0d9b44d265a1d947c8766295ba00 (diff) | |
download | linux-c9befd5958fdf8913db69049d47b6ac1d970af03.tar.xz |
KVM: selftests: add shmem backing source type
This lets us run the demand paging test on top of a shmem-backed area.
In follow-up commits, we'll 1) leverage this new capability to create an
alias mapping, and then 2) use the alias mapping to exercise UFFD minor
faults.
Signed-off-by: Axel Rasmussen <axelrasmussen@google.com>
Message-Id: <20210519200339.829146-8-axelrasmussen@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/lib/test_util.c')
-rw-r--r-- | tools/testing/selftests/kvm/lib/test_util.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/lib/test_util.c b/tools/testing/selftests/kvm/lib/test_util.c index 06ddde068736..c7a265da5090 100644 --- a/tools/testing/selftests/kvm/lib/test_util.c +++ b/tools/testing/selftests/kvm/lib/test_util.c @@ -236,6 +236,10 @@ const struct vm_mem_backing_src_alias *vm_mem_backing_src_alias(uint32_t i) .name = "anonymous_hugetlb_16gb", .flag = anon_huge_flags | MAP_HUGE_16GB, }, + [VM_MEM_SRC_SHMEM] = { + .name = "shmem", + .flag = MAP_SHARED, + }, }; _Static_assert(ARRAY_SIZE(aliases) == NUM_SRC_TYPES, "Missing new backing src types?"); @@ -253,6 +257,7 @@ size_t get_backing_src_pagesz(uint32_t i) switch (i) { case VM_MEM_SRC_ANONYMOUS: + case VM_MEM_SRC_SHMEM: return getpagesize(); case VM_MEM_SRC_ANONYMOUS_THP: return get_trans_hugepagesz(); |