linux/Documentation/virt/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
..
arm KVM: arm64: Some fixes of PV-time interface document 2020-12-03 19:01:01 +00:00
devices KVM: arm64: Fix some documentation build warnings 2020-10-02 09:12:25 +01:00
amd-memory-encryption.rst KVM/SVM: add support for SEV attestation command 2021-02-04 05:27:20 -05:00
api.rst KVM: x86/xen: Add support for vCPU runstate information 2021-03-02 14:30:54 -05:00
cpuid.rst x86/kvm: Reserve KVM_FEATURE_MSI_EXT_DEST_ID 2020-10-28 13:52:05 -04:00
halt-polling.rst docs: virt: convert halt-polling.txt to ReST format 2020-02-12 20:09:50 +01:00
hypercalls.rst docs: fix broken references to text files 2020-04-20 15:35:59 -06:00
index.rst docs/virt/kvm: Document configuring and running nested guests 2020-05-06 05:45:47 -04:00
locking.rst KVM: x86/mmu: Use atomic ops to set SPTEs in TDP MMU map 2021-02-04 05:27:44 -05:00
mmu.rst KVM: mmu: Fix SPTE encoding of MMIO generation upper half 2020-12-11 19:18:43 -05:00
msr.rst KVM: x86: announce KVM_FEATURE_ASYNC_PF_INT 2020-06-01 04:26:08 -04:00
nested-vmx.rst KVM: Documentation: Fix documentation for nested. 2021-01-28 13:03:14 -05:00
ppc-pv.rst docs: kvm: Convert ppc-pv.txt to ReST format 2020-02-12 20:10:05 +01:00
review-checklist.rst docs: fix broken references for ReST files that moved around 2020-04-20 15:45:03 -06:00
running-nested-guests.rst KVM: Documentation: Fix documentation for nested. 2021-01-28 13:03:14 -05:00
s390-diag.rst docs: kvm: Convert s390-diag.txt to ReST format 2020-02-12 20:10:06 +01:00
s390-pv-boot.rst DOCUMENTATION: Protected virtual machine introduction and IPL 2020-02-27 19:47:12 +01:00
s390-pv.rst Documentation: virt: kvm/s390-pv: drop doubled words 2020-07-05 14:42:17 -06:00
timekeeping.rst docs: kvm: Convert timekeeping.txt to ReST format 2020-02-12 20:10:06 +01:00
vcpu-requests.rst