summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2011-04-12 12:36:25 +0300
committerAvi Kivity <avi@redhat.com>2011-05-22 08:39:54 -0400
commit2aab2c5b2bac6510b3bd143ca83babee382f4302 (patch)
tree5b2cd8e63335f0b4c09f9106a58286febeb229b1 /arch
parent0004c7c25757f103ddb3a9e4bcfd533aad41f9a0 (diff)
downloadlinux-3.10-2aab2c5b2bac6510b3bd143ca83babee382f4302.tar.gz
linux-3.10-2aab2c5b2bac6510b3bd143ca83babee382f4302.tar.bz2
linux-3.10-2aab2c5b2bac6510b3bd143ca83babee382f4302.zip
KVM: call cache_all_regs() only once during instruction emulation
Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/x86.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index a9a307a7546..f5f2d3d4457 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4459,6 +4459,12 @@ static void init_emulate_ctxt(struct kvm_vcpu *vcpu)
struct decode_cache *c = &vcpu->arch.emulate_ctxt.decode;
int cs_db, cs_l;
+ /*
+ * TODO: fix emulate.c to use guest_read/write_register
+ * instead of direct ->regs accesses, can save hundred cycles
+ * on Intel for instructions that don't read/change RSP, for
+ * for example.
+ */
cache_all_regs(vcpu);
kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l);
@@ -4562,14 +4568,6 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu,
kvm_clear_exception_queue(vcpu);
- /*
- * TODO: fix emulate.c to use guest_read/write_register
- * instead of direct ->regs accesses, can save hundred cycles
- * on Intel for instructions that don't read/change RSP, for
- * for example.
- */
- cache_all_regs(vcpu);
-
if (!(emulation_type & EMULTYPE_NO_DECODE)) {
init_emulate_ctxt(vcpu);
vcpu->arch.emulate_ctxt.interruptibility = 0;