KVM: selftests: Don't assert on exact number of 4KiB in dirty log split test
authorSean Christopherson <seanjc@google.com>
Wed, 31 Jan 2024 22:27:28 +0000 (14:27 -0800)
committerSean Christopherson <seanjc@google.com>
Tue, 6 Feb 2024 18:55:13 +0000 (10:55 -0800)
commit6fd78beed0213655c16ef728af0caec6d5ae4c73
treec3d2d21619db6e6eaa5e573229802bf41484e08d
parentba58f873cdeec30b6da48e28dd5782c5a3e1371b
KVM: selftests: Don't assert on exact number of 4KiB in dirty log split test

Drop dirty_log_page_splitting_test's assertion that the number of 4KiB
pages remains the same across dirty logging being enabled and disabled, as
the test doesn't guarantee that mappings outside of the memslots being
dirty logged are stable, e.g. KVM's mappings for code and pages in
memslot0 can be zapped by things like NUMA balancing.

To preserve the spirit of the check, assert that (a) the number of 4KiB
pages after splitting is _at least_ the number of 4KiB pages across all
memslots under test, and (b) the number of hugepages before splitting adds
up to the number of pages across all memslots under test.  (b) is a little
tenuous as it relies on memslot0 being incompatible with transparent
hugepages, but that holds true for now as selftests explicitly madvise()
MADV_NOHUGEPAGE for memslot0 (__vm_create() unconditionally specifies the
backing type as VM_MEM_SRC_ANONYMOUS).

Reported-by: Yi Lai <yi1.lai@intel.com>
Reported-by: Tao Su <tao1.su@linux.intel.com>
Reviewed-by: Tao Su <tao1.su@linux.intel.com>
Link: https://lore.kernel.org/r/20240131222728.4100079-1-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/x86_64/dirty_log_page_splitting_test.c