]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: emulate: protect checks on ctxt->d by a common "if (unlikely())"
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 27 Mar 2014 10:58:02 +0000 (11:58 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 11 Jul 2014 07:13:58 +0000 (09:13 +0200)
commit99e6012a29e57743ab218f8d009060fa2ab75462
tree774afe302d8a79ce59bdc17f8d213e5d4564b9ed
parent10f41043f1c06bc565e054fd5a3351237cb329c4
KVM: emulate: protect checks on ctxt->d by a common "if (unlikely())"

There are several checks for "peculiar" aspects of instructions in both
x86_decode_insn and x86_emulate_insn.  Group them together, and guard
them with a single "if" that lets the processor quickly skip them all.
Make this more effective by adding two more flag bits that say whether the
.intercept and .check_perm fields are valid.  We will reuse these
flags later to avoid initializing fields of the emulate_ctxt struct.

This skims about 30 cycles for each emulated instructions, which is
approximately a 3% improvement.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/emulate.c