What does KVM_HINTS_REALTIME do?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I was just in a discussion where we realized KVM_HINTS_REALTIME is a
little underdocumented. Here is attempt to address that. Please correct
me if there are inaccuracies or reply if you have additional questions:

KVM_HINTS_REALTIME (aka QEMU kvm-hint-dedicated) is defined as follows
in Documentation/virt/kvm/cpuid.rst:

  guest checks this feature bit to determine that vCPUs are never
  preempted for an unlimited time allowing optimizations

Users or management tools set this flag themselves (it is not set
automatically). This raises the question of what effects this flag has
and when it should be set.

When should I set KVM_HINTS_REALTIME?
-------------------------------------
When vCPUs are pinned to dedicated pCPUs. Even better if the isolcpus=
kernel parameter is used on the host so there are no disturbances.

Is the flag guest-wide or per-vCPU?
-----------------------------------
This flag is guest-wide so all vCPUs should be dedicated, not just some
of them.

Which Linux guest features are affected?
----------------------------------------
PV spinlocks, PV TLB flush, and PV sched yield are disabled by
KVM_HINTS_REALTIME. This is because no other vCPUs or host tasks will be
running on the pCPUs, so there is no benefit in involving the host.

The cpuidle-haltpoll driver is enabled by KVM_HINTS_REALTIME. This
driver performs busy waiting inside the guest before halting the CPU in
order to avoid the vCPU's wakeup latency. This driver also has a boolean
"force" module parameter if you wish to enable it without setting
KVM_HINTS_REALTIME.

When KVM_HINTS_REALTIME is set, the KVM_CAP_X86_DISABLE_EXITS capability
can also be used to disable MWAIT/HLT/PAUSE/CSTATE exits. This improves
the latency of these operations. The user or management tools need to
disable these exits themselves, e.g. with QEMU's -overcommit cpu-pm=on.

Stefan

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux