1
0
Fork 0
alistair23-linux/tools/testing/selftests/kvm
Sean Christopherson 0f73bbc851 KVM: selftests: complete IO before migrating guest state
Documentation/virtual/kvm/api.txt states:

  NOTE: For KVM_EXIT_IO, KVM_EXIT_MMIO, KVM_EXIT_OSI, KVM_EXIT_PAPR and
        KVM_EXIT_EPR the corresponding operations are complete (and guest
        state is consistent) only after userspace has re-entered the
        kernel with KVM_RUN.  The kernel side will first finish incomplete
        operations and then check for pending signals.  Userspace can
        re-enter the guest with an unmasked signal pending to complete
        pending operations.

Because guest state may be inconsistent, starting state migration after
an IO exit without first completing IO may result in test failures, e.g.
a proposed change to KVM's handling of %rip in its fast PIO handling[1]
will cause the new VM, i.e. the post-migration VM, to have its %rip set
to the IN instruction that triggered KVM_EXIT_IO, leading to a test
assertion due to a stage mismatch.

For simplicitly, require KVM_CAP_IMMEDIATE_EXIT to complete IO and skip
the test if it's not available.  The addition of KVM_CAP_IMMEDIATE_EXIT
predates the state selftest by more than a year.

[1] https://patchwork.kernel.org/patch/10848545/

Fixes: fa3899add1 ("kvm: selftests: add basic test for state save and restore")
Reported-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-03-28 17:29:09 +01:00
..
include KVM: selftests: complete IO before migrating guest state 2019-03-28 17:29:09 +01:00
lib KVM: selftests: complete IO before migrating guest state 2019-03-28 17:29:09 +01:00
x86_64 KVM: selftests: complete IO before migrating guest state 2019-03-28 17:29:09 +01:00
.gitignore selftests: kvm: add selftest for releasing VM file descriptor while in L2 2019-02-12 13:12:12 +01:00
Makefile KVM: selftests: disable stack protector for all KVM tests 2019-03-28 17:29:08 +01:00
clear_dirty_log_test.c kvm: introduce manual dirty log reprotect 2018-12-14 12:34:19 +01:00
dirty_log_test.c kvm: selftests: aarch64: dirty_log_test: support greater than 40-bit IPAs 2018-12-21 11:28:30 +01:00