linux-stable/tools
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
..
accounting
arch tools headers uapi: Sync copy of asm-generic/unistd.h with the kernel sources 2019-03-11 16:13:04 -03:00
bpf bpftool: use bpf_program__get_prog_info_linear() in prog.c:do_dump() 2019-03-19 16:52:06 -03:00
build perf build: Check what binutils's 'disassembler()' signature to use 2019-03-20 16:42:10 -03:00
cgroup
crypto
debugging
firewire
firmware tools/firmware/ihex2fw: Replace explicit alignment with ALIGN 2019-01-22 10:23:18 +01:00
gpio
hv
iio Merge 5.0-rc6 into staging-next 2019-02-11 09:25:01 +01:00
include perf/core improvements and fixes: 2019-03-22 22:50:41 +01:00
io_uring io_uring: add a few test tools 2019-03-06 13:00:16 -07:00
kvm/kvm_stat
laptop
leds
lib perf/core improvements and fixes: 2019-03-22 22:51:21 +01:00
memory-model tools/memory-model: Make scripts take "-j" abbreviation for "--jobs" 2019-01-21 11:07:04 +01:00
nfsd
objtool objtool: Move objtool_file struct off the stack 2019-03-21 12:02:19 +01:00
pci
pcmcia
perf perf/core improvements and fixes: 2019-03-22 22:51:21 +01:00
power tools/power turbostat: return the exit status of a command 2019-03-19 16:51:16 +01:00
scripts
spi
testing KVM: selftests: complete IO before migrating guest state 2019-03-28 17:29:09 +01:00
thermal/tmon
time
usb
virtio
vm tools/vm/slabinfo: clean up usage menu debug items 2019-03-05 21:07:20 -08:00
wmi
Makefile Merge branch 'thorsten' into docs-next 2019-01-08 16:38:36 -07:00