From patchwork Thu Aug 27 12:07:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 44246 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7RC7aUZ014881 for ; Thu, 27 Aug 2009 12:07:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751864AbZH0MHc (ORCPT ); Thu, 27 Aug 2009 08:07:32 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751917AbZH0MHc (ORCPT ); Thu, 27 Aug 2009 08:07:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59689 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750963AbZH0MHb (ORCPT ); Thu, 27 Aug 2009 08:07:31 -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.13.8/8.13.8) with ESMTP id n7RC7Xan024892 for ; Thu, 27 Aug 2009 08:07:33 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7RC7VuM029924; Thu, 27 Aug 2009 08:07:32 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id B941B18D467; Thu, 27 Aug 2009 15:07:30 +0300 (IDT) Date: Thu, 27 Aug 2009 15:07:30 +0300 From: Gleb Natapov To: avi@redhat.com Cc: kvm@vger.kernel.org Subject: [PATCH] call vmx_load_host_state() only if msr is cached Message-ID: <20090827120730.GN30093@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org No need to call it before each kvm_(set|get)_msr_common() Signed-off-by: Gleb Natapov --- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 6b57eed..7494ef1 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1005,9 +1005,9 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata) data = vmcs_readl(GUEST_SYSENTER_ESP); break; default: - vmx_load_host_state(to_vmx(vcpu)); msr = find_msr_entry(to_vmx(vcpu), msr_index); if (msr) { + vmx_load_host_state(to_vmx(vcpu)); data = msr->data; break; } @@ -1064,9 +1064,9 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data) } /* Otherwise falls through to kvm_set_msr_common */ default: - vmx_load_host_state(vmx); msr = find_msr_entry(vmx, msr_index); if (msr) { + vmx_load_host_state(vmx); msr->data = data; break; }