mirror of https://gitee.com/openkylin/linux.git
30b5c851af
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> |
||
---|---|---|
.. | ||
cr4_cpuid_sync_test.c | ||
debug_regs.c | ||
evmcs_test.c | ||
get_cpuid_test.c | ||
hyperv_cpuid.c | ||
kvm_pv_test.c | ||
mmio_warning_test.c | ||
platform_info_test.c | ||
set_sregs_test.c | ||
smm_test.c | ||
state_test.c | ||
svm_vmcall_test.c | ||
sync_regs_test.c | ||
tsc_msrs_test.c | ||
userspace_msr_exit_test.c | ||
vmx_apic_access_test.c | ||
vmx_close_while_nested_test.c | ||
vmx_dirty_log_test.c | ||
vmx_pmu_msrs_test.c | ||
vmx_preemption_timer_test.c | ||
vmx_set_nested_state_test.c | ||
vmx_tsc_adjust_test.c | ||
xapic_ipi_test.c | ||
xen_shinfo_test.c | ||
xen_vmcall_test.c | ||
xss_msr_test.c |