linux/tools/testing/selftests/kvm/x86_64
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
..
cr4_cpuid_sync_test.c KVM: selftests: x86: Set supported CPUIDs on default VM 2020-11-16 13:14:20 -05:00
debug_regs.c KVM: selftests: x86: Set supported CPUIDs on default VM 2020-11-16 13:14:20 -05:00
evmcs_test.c KVM: x86: hyper-v: Make Hyper-V emulation enablement conditional 2021-02-09 08:39:56 -05:00
get_cpuid_test.c selftest: kvm: x86: test KVM_GET_CPUID2 and guest visible CPUIDs against KVM_GET_SUPPORTED_CPUID 2021-02-04 05:27:36 -05:00
hyperv_cpuid.c selftests: kvm: Move kvm_get_supported_hv_cpuid() to common code 2021-02-09 08:17:09 -05:00
kvm_pv_test.c KVM: selftests: Make test skipping consistent 2020-11-16 13:14:20 -05:00
mmio_warning_test.c KVM: selftests: Use consistent message for test skipping 2020-03-16 17:59:05 +01:00
platform_info_test.c KVM: selftests: Use consistent message for test skipping 2020-03-16 17:59:05 +01:00
set_sregs_test.c KVM: selftests: Verify supported CR4 bits can be set before KVM_SET_CPUID2 2020-11-15 09:49:08 -05:00
smm_test.c KVM: selftests: x86: Set supported CPUIDs on default VM 2020-11-16 13:14:20 -05:00
state_test.c KVM: selftests: x86: Set supported CPUIDs on default VM 2020-11-16 13:14:20 -05:00
svm_vmcall_test.c KVM: selftests: x86: Set supported CPUIDs on default VM 2020-11-16 13:14:20 -05:00
sync_regs_test.c KVM: selftests: Use consistent message for test skipping 2020-03-16 17:59:05 +01:00
tsc_msrs_test.c KVM: selftests: x86: Set supported CPUIDs on default VM 2020-11-16 13:14:20 -05:00
userspace_msr_exit_test.c selftests: kvm: Merge user_msr_test into userspace_msr_exit_test 2020-12-11 19:00:58 -05:00
vmx_apic_access_test.c KVM: selftests: x86: Set supported CPUIDs on default VM 2020-11-16 13:14:20 -05:00
vmx_close_while_nested_test.c KVM: selftests: x86: Set supported CPUIDs on default VM 2020-11-16 13:14:20 -05:00
vmx_dirty_log_test.c KVM: selftests: x86: Set supported CPUIDs on default VM 2020-11-16 13:14:20 -05:00
vmx_pmu_msrs_test.c selftests: kvm/x86: add test for pmu msr MSR_IA32_PERF_CAPABILITIES 2021-02-04 05:27:27 -05:00
vmx_preemption_timer_test.c KVM: selftests: x86: Set supported CPUIDs on default VM 2020-11-16 13:14:20 -05:00
vmx_set_nested_state_test.c KVM: selftests: x86: Set supported CPUIDs on default VM 2020-11-16 13:14:20 -05:00
vmx_tsc_adjust_test.c KVM: selftests: x86: Set supported CPUIDs on default VM 2020-11-16 13:14:20 -05:00
xapic_ipi_test.c KVM: selftests: Test IPI to halted vCPU in xAPIC while backing page moves 2021-02-04 05:27:17 -05:00
xen_shinfo_test.c KVM: x86/xen: Add support for vCPU runstate information 2021-03-02 14:30:54 -05:00
xen_vmcall_test.c KVM: selftests: Fix size of memslots created by Xen tests 2021-02-11 08:02:09 -05:00
xss_msr_test.c KVM: selftests: Use consistent message for test skipping 2020-03-16 17:59:05 +01:00