OSDN Git Service

KVM: selftests: Add NX huge pages test
authorBen Gardon <bgardon@google.com>
Mon, 13 Jun 2022 21:25:19 +0000 (21:25 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 24 Jun 2022 08:51:50 +0000 (04:51 -0400)
commit8448ec5993beee031376e36f77969cc0a07d8c6b
tree10de6b236345188fa3c69685f071ca38c880fc59
parent084cc29f8bbb034cf30a7ee07a816c115e0c28df
KVM: selftests: Add NX huge pages test

There's currently no test coverage of NX hugepages in KVM selftests, so
add a basic test to ensure that the feature works as intended.

The test creates a VM with a data slot backed with huge pages. The
memory in the data slot is filled with op-codes for the return
instruction. The guest then executes a series of accesses on the memory,
some reads, some instruction fetches. After each operation, the guest
exits and the test performs some checks on the backing page counts to
ensure that NX page splitting an reclaim work as expected.

Reviewed-by: David Matlack <dmatlack@google.com>
Signed-off-by: Ben Gardon <bgardon@google.com>
Message-Id: <20220613212523.3436117-7-bgardon@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/.gitignore
tools/testing/selftests/kvm/Makefile
tools/testing/selftests/kvm/include/kvm_util_base.h
tools/testing/selftests/kvm/lib/kvm_util.c
tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.c [new file with mode: 0644]
tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.sh [new file with mode: 0755]