KVM: selftests: Add dirty logging page splitting test
authorBen Gardon <bgardon@google.com>
Tue, 31 Jan 2023 18:18:20 +0000 (18:18 +0000)
committerSean Christopherson <seanjc@google.com>
Thu, 1 Jun 2023 21:03:19 +0000 (14:03 -0700)
commitdfa78a20cc879205b2c6239300dac09907ad3da1
tree2f5a33805d75a385b9bc739a363ea166a9d05a3b
parentde10b798055db5df93474cdfa5dbffc57169f458
KVM: selftests: Add dirty logging page splitting test

Add a test for page splitting during dirty logging and for hugepage
recovery after dirty logging.

Page splitting represents non-trivial behavior, which is complicated
by MANUAL_PROTECT mode, which causes pages to be split on the first
clear, instead of when dirty logging is enabled.

Add a test which makes assertions about page counts to help define the
expected behavior of page splitting and to provide needed coverage of the
behavior. This also helps ensure that a failure in eager page splitting
is not covered up by splitting in the vCPU path.

Tested by running the test on an Intel Haswell machine w/wo
MANUAL_PROTECT.

Reviewed-by: Vipin Sharma <vipinsh@google.com>
Signed-off-by: Ben Gardon <bgardon@google.com>
Link: https://lore.kernel.org/r/20230131181820.179033-3-bgardon@google.com
[sean: let the user run without hugetlb, as suggested by Paolo]
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/Makefile
tools/testing/selftests/kvm/x86_64/dirty_log_page_splitting_test.c [new file with mode: 0644]