KVM no longer intercepts MWAIT instructions since Linux 4.12 commit 668fffa3f838 ("kvm: better MWAIT emulation for guests") for improved latency in some workloads. This series takes the idea further and makes the interception of HLT (patch 2) and PAUSE (patch 3) optional as well for similar reasons. Both interceptions can be turned off for an individual VM by enabling the corresponding capability. It also converts KVM_CAP_X86_GUEST_MWAIT into an initially disabled capability that has to be enabled explicitly for a VM. This restores pre Linux 4.12 behavior in the default case, so that a guest cannot put CPUs into low power states, which may exceed the host's latency requirements (patch 1). Jan H. Schönherr (3): KVM: Don't enable MWAIT in guest by default KVM: Add capability to not exit on HLT KVM: Add capability to not exit on PAUSE Documentation/virtual/kvm/api.txt | 38 +++++++++++++++++++------ arch/x86/include/asm/kvm_host.h | 4 +++ arch/x86/kvm/svm.c | 8 ++++-- arch/x86/kvm/vmx.c | 59 +++++++++++++++++++++++++++++---------- arch/x86/kvm/x86.c | 54 ++++++++++++++++++++++++++++++++++- arch/x86/kvm/x86.h | 41 +++++++-------------------- include/uapi/linux/kvm.h | 2 ++ 7 files changed, 148 insertions(+), 58 deletions(-) -- 2.3.1.dirty