From: Paolo Bonzini Date: Thu, 27 Mar 2014 10:29:28 +0000 (+0100) Subject: KVM: x86: avoid useless set of KVM_REQ_EVENT after emulation X-Git-Tag: omap-for-v3.17/fixes-against-rc2~184^2~40 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6addfc42992be4b073c39137ecfdf4b2aa2d487f;p=pandora-kernel.git KVM: x86: avoid useless set of KVM_REQ_EVENT after emulation Despite the provisions to emulate up to 130 consecutive instructions, in practice KVM will emulate just one before exiting handle_invalid_guest_state, because x86_emulate_instruction always sets KVM_REQ_EVENT. However, we only need to do this if an interrupt could be injected, which happens a) if an interrupt shadow bit (STI or MOV SS) has gone away; b) if the interrupt flag has just been set (other instructions than STI can set it without enabling an interrupt shadow). This cuts another 700-900 cycles from the cost of emulating an instruction (measured on a Sandy Bridge Xeon: 1650-2600 cycles before the patch on kvm-unit-tests, 925-1700 afterwards). Signed-off-by: Paolo Bonzini --- Reading git-diff-tree failed