Skip to content

Optimize STI; HLT while an interrupt is pending

Avi Kivity kvm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3KVM: VMX: Cache CPU_BASED_VM_EXEC_CONTROL VMCS fieldarch/x86/kvm/vmx.c+29 -310 replies
2/3KVM: VMX: Short circuit STI; HLT while an interrupt is pendingarch/x86/kvm/vmx.c+9 -06 replies
3/3KVM: SVM: Short circuit STI; HLT while an interrupt is pendingarch/x86/kvm/svm.c+9 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] Optimize STI; HLT while an interrupt is pending

If the guest executes the following code sequence

CLI
...
(interrupt becomes pending)
STI
HLT

then we will exit on HLT, enter the guest, and exit immediately again on virtual interrupt pending. As this is wasteful, this patch set short circuits the whole operation to inject the interrupt immediately.

(as I've seen this occur very rarely in ftrace, compared to what I saw before I wrote the patch, please don't apply patches 2 and 3 until I've had a chance to benchmark it)

Avi Kivity (3):
KVM: VMX: Cache CPU_BASED_VM_EXEC_CONTROL VMCS field
KVM: VMX: Short circuit STI; HLT while an interrupt is pending
KVM: SVM: Short circuit STI; HLT while an interrupt is pending

 arch/x86/kvm/svm.c |    9 +++++++
 arch/x86/kvm/vmx.c |   69 ++++++++++++++++++++++++++++-----------------------
 2 files changed, 47 insertions(+), 31 deletions(-)