diff options
author | Sean Christopherson <seanjc@google.com> | 2023-10-27 11:22:08 -0700 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2023-11-14 08:01:06 -0500 |
commit | bb2968ad6c33c0902dce48ea57d58c5bb4f3c617 (patch) | |
tree | 3750ca1d96cc1bb5c0b6e1b99fe8562e4fef85b5 /tools/testing/selftests/bpf/prog_tests/async_stack_depth.c | |
parent | 8d99e347c097ab3f9fb93d0f88dddf20051d7c88 (diff) |
KVM: selftests: Add support for creating private memslots
Add support for creating "private" memslots via KVM_CREATE_GUEST_MEMFD and
KVM_SET_USER_MEMORY_REGION2. Make vm_userspace_mem_region_add() a wrapper
to its effective replacement, vm_mem_add(), so that private memslots are
fully opt-in, i.e. don't require update all tests that add memory regions.
Pivot on the KVM_MEM_PRIVATE flag instead of the validity of the "gmem"
file descriptor so that simple tests can let vm_mem_add() do the heavy
lifting of creating the guest memfd, but also allow the caller to pass in
an explicit fd+offset so that fancier tests can do things like back
multiple memslots with a single file. If the caller passes in a fd, dup()
the fd so that (a) __vm_mem_region_delete() can close the fd associated
with the memory region without needing yet another flag, and (b) so that
the caller can safely close its copy of the fd without having to first
destroy memslots.
Co-developed-by: Ackerley Tng <ackerleytng@google.com>
Signed-off-by: Ackerley Tng <ackerleytng@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20231027182217.3615211-27-seanjc@google.com>
Reviewed-by: Fuad Tabba <tabba@google.com>
Tested-by: Fuad Tabba <tabba@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/async_stack_depth.c')
0 files changed, 0 insertions, 0 deletions