As a part of the effort to start running kvm selftests nested, this patch series contains several fixes to the dirty_log_test, which allows this test to run nested very well.
I also included a mostly nop change to KVM, to reverse the order in which the PML log is read to align more closely to the hardware. It should not affect regular users of the dirty logging but it fixes a unit test specific assumption in the dirty_log_test dirty-ring mode.
Patch 4 fixes a very rare problem, which is hard to reproduce with standard test parameters, but due to some weird timing issue, it actually happened a few times on my machine which prompted me to investigate it.
The issue can be reproduced well by running the test nested (without patch 4 applied) with a very short iteration time and with a few iterations in a loop like this:
while ./dirty_log_test -i 10 -I 1 -M dirty-ring ; do true ; done
Or even better, it's possible to manually patch the test to not wait at all (effectively setting iteration time to 0), then it fails pretty fast.
Best regards, Maxim Levitsky
Maxim Levitsky (4): KVM: VMX: read the PML log in the same order as it was written KVM: selftests: dirty_log_test: Limit s390x workaround to s390x KVM: selftests: dirty_log_test: run the guest until some dirty ring entries were harvested KVM: selftests: dirty_log_test: support multiple write retires
arch/x86/kvm/vmx/vmx.c | 32 +++++--- arch/x86/kvm/vmx/vmx.h | 1 + tools/testing/selftests/kvm/dirty_log_test.c | 79 +++++++++++++++++--- 3 files changed, 91 insertions(+), 21 deletions(-)