linux-stable/tools/testing/selftests/kvm
David Woodhouse 30b5c851af KVM: x86/xen: Add support for vCPU runstate information
This is how Xen guests do steal time accounting. The hypervisor records
the amount of time spent in each of running/runnable/blocked/offline
states.

In the Xen accounting, a vCPU is still in state RUNSTATE_running while
in Xen for a hypercall or I/O trap, etc. Only if Xen explicitly schedules
does the state become RUNSTATE_blocked. In KVM this means that even when
the vCPU exits the kvm_run loop, the state remains RUNSTATE_running.

The VMM can explicitly set the vCPU to RUNSTATE_blocked by using the
KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_CURRENT attribute, and can also use
KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADJUST to retrospectively add a given
amount of time to the blocked state and subtract it from the running
state.

The state_entry_time corresponds to get_kvmclock_ns() at the time the
vCPU entered the current state, and the total times of all four states
should always add up to state_entry_time.

Co-developed-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Message-Id: <20210301125309.874953-2-dwmw2@infradead.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-03-02 14:30:54 -05:00
..
aarch64 KVM: arm64: selftests: Filter out DEMUX registers 2020-11-27 19:46:47 +00:00
include KVM: selftests: Add missing header file needed by xAPIC IPI tests 2021-02-11 08:02:08 -05:00
lib selftests: kvm: Mmap the entire vcpu mmap area 2021-03-02 14:30:53 -05:00
s390x KVM: selftests: sync_regs test for diag318 2020-12-10 13:36:05 +01:00
x86_64 KVM: x86/xen: Add support for vCPU runstate information 2021-03-02 14:30:54 -05:00
.gitignore selftests: kvm: add hardware_disable test 2021-02-15 11:42:36 -05:00
config selftests: kvm: Adding config fragments 2019-08-09 16:52:38 +02:00
demand_paging_test.c KVM: selftests: Add backing src parameter to dirty_log_perf_test 2021-02-04 05:27:19 -05:00
dirty_log_perf_test.c KVM: selftests: Disable dirty logging with vCPUs running 2021-02-04 05:27:20 -05:00
dirty_log_test.c KVM: selftests: Factor out guest mode code 2021-01-07 18:07:29 -05:00
hardware_disable_test.c selftests: kvm: add hardware_disable test 2021-02-15 11:42:36 -05:00
kvm_create_max_vcpus.c KVM: selftests: Convert some printf's to pr_info's 2020-03-16 17:57:07 +01:00
Makefile selftests: kvm: add hardware_disable test 2021-02-15 11:42:36 -05:00
memslot_modification_stress_test.c KVM: selftests: Add backing src parameter to dirty_log_perf_test 2021-02-04 05:27:19 -05:00
set_memory_region_test.c Merge branch 'kvm-master' into kvm-next 2021-01-07 18:06:52 -05:00
settings selftests: kvm: Raise the default timeout to 120 seconds 2021-02-09 08:17:08 -05:00
steal_time.c KVM: selftests: Rework timespec functions and usage 2020-03-18 14:08:56 +01:00