Skip to content

Commit cde363a

Browse files
committed
Documentation: KVM: add API issues section
Add a section to document all the different ways in which the KVM API sucks. I am sure there are way more, give people a place to vent so that userspace authors are aware. Signed-off-by: Paolo Bonzini <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 4501672 commit cde363a

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

Documentation/virt/kvm/api.rst

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7719,3 +7719,49 @@ only be invoked on a VM prior to the creation of VCPUs.
77197719
At this time, KVM_PMU_CAP_DISABLE is the only capability. Setting
77207720
this capability will disable PMU virtualization for that VM. Usermode
77217721
should adjust CPUID leaf 0xA to reflect that the PMU is disabled.
7722+
7723+
9. Known KVM API problems
7724+
=========================
7725+
7726+
In some cases, KVM's API has some inconsistencies or common pitfalls
7727+
that userspace need to be aware of. This section details some of
7728+
these issues.
7729+
7730+
Most of them are architecture specific, so the section is split by
7731+
architecture.
7732+
7733+
9.1. x86
7734+
--------
7735+
7736+
``KVM_GET_SUPPORTED_CPUID`` issues
7737+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7738+
7739+
In general, ``KVM_GET_SUPPORTED_CPUID`` is designed so that it is possible
7740+
to take its result and pass it directly to ``KVM_SET_CPUID2``. This section
7741+
documents some cases in which that requires some care.
7742+
7743+
Local APIC features
7744+
~~~~~~~~~~~~~~~~~~~
7745+
7746+
CPU[EAX=1]:ECX[21] (X2APIC) is reported by ``KVM_GET_SUPPORTED_CPUID``,
7747+
but it can only be enabled if ``KVM_CREATE_IRQCHIP`` or
7748+
``KVM_ENABLE_CAP(KVM_CAP_IRQCHIP_SPLIT)`` are used to enable in-kernel emulation of
7749+
the local APIC.
7750+
7751+
The same is true for the ``KVM_FEATURE_PV_UNHALT`` paravirtualized feature.
7752+
7753+
CPU[EAX=1]:ECX[24] (TSC_DEADLINE) is not reported by ``KVM_GET_SUPPORTED_CPUID``.
7754+
It can be enabled if ``KVM_CAP_TSC_DEADLINE_TIMER`` is present and the kernel
7755+
has enabled in-kernel emulation of the local APIC.
7756+
7757+
Obsolete ioctls and capabilities
7758+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7759+
7760+
KVM_CAP_DISABLE_QUIRKS does not let userspace know which quirks are actually
7761+
available. Use ``KVM_CHECK_EXTENSION(KVM_CAP_DISABLE_QUIRKS2)`` instead if
7762+
available.
7763+
7764+
Ordering of KVM_GET_*/KVM_SET_* ioctls
7765+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7766+
7767+
TBD

0 commit comments

Comments
 (0)