From: Gleb Natapov Subject: [PATCH 5/5] KVM: call cache_all_regs() only once during instruction emulation. Date: Tue, 12 Apr 2011 12:36:25 +0300 Message-ID: <1302600985-10704-5-git-send-email-gleb@redhat.com> References: <1302600985-10704-1-git-send-email-gleb@redhat.com> Cc: avi@redhat.com, mtosatti@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:43125 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751844Ab1DLJg2 (ORCPT ); Tue, 12 Apr 2011 05:36:28 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3C9aRFi015695 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 12 Apr 2011 05:36:27 -0400 In-Reply-To: <1302600985-10704-1-git-send-email-gleb@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Gleb Natapov --- arch/x86/kvm/x86.c | 14 ++++++-------- 1 files changed, 6 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 609c7ab..efe196c 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4404,6 +4404,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); @@ -4505,14 +4511,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; -- 1.7.2.3