]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - arch/x86/kvm/emulate.c
KVM: emulate: speed up emulated moves
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 27 Mar 2014 10:36:25 +0000 (11:36 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 11 Jul 2014 07:13:58 +0000 (09:13 +0200)
commit54cfdb3e95d4f70409a7d3432a42cffc9a232be7
tree01ad8c40d9c316b7359fb7e7605ba0c9b85a75eb
parentd40a6898e50c2589ca3d345ef5ca6671e2b35b1a
KVM: emulate: speed up emulated moves

We can just blindly move all 16 bytes of ctxt->src's value to ctxt->dst.
write_register_operand will take care of writing only the lower bytes.

Avoiding a call to memcpy (the compiler optimizes it out) gains about
200 cycles on kvm-unit-tests for register-to-register moves, and makes
them about as fast as arithmetic instructions.

We could perhaps get a larger speedup by moving all instructions _except_
moves out of x86_emulate_insn, removing opcode_len, and replacing the
switch statement with an inlined em_mov.

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