From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Yang, Sheng" Subject: [PATCH] KVM: VMX: Fix a wrong usage of vmcs_config Date: Wed, 18 Jun 2008 14:44:12 +0800 Message-ID: <200806181444.12511.sheng.yang@intel.com> Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_86KWIftwD0RfDKG" To: kvm@vger.kernel.org Return-path: Received: from mga09.intel.com ([134.134.136.24]:15636 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756047AbYFRGoT (ORCPT ); Wed, 18 Jun 2008 02:44:19 -0400 Sender: kvm-owner@vger.kernel.org List-ID: --Boundary-00=_86KWIftwD0RfDKG Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline =46rom a1c929709718c015686b0c23046cc08b8bc47a62 Mon Sep 17 00:00:00 2001 =46rom: Sheng Yang Date: Wed, 18 Jun 2008 14:43:38 +0800 Subject: [PATCH] KVM: VMX: Fix a wrong usage of vmcs_config The function ept_update_paging_mode_cr0() write to CPU_BASED_VM_EXEC_CONTROL based on vmcs_config.cpu_based_exec_ctrl. That's wrong because the variable may not consistent with the content in the CPU_BASE_VM_EXEC_CONTROL MSR. Signed-off-by: Sheng Yang =2D-- arch/x86/kvm/vmx.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 6e4278d..6a31406 100644 =2D-- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1438,7 +1438,7 @@ static void ept_update_paging_mode_cr0(unsigned long= =20 *hw_cr0, if (!(cr0 & X86_CR0_PG)) { /* From paging/starting to nonpaging */ vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, =2D vmcs_config.cpu_based_exec_ctrl | + vmcs_read32(CPU_BASED_VM_EXEC_CONTROL) | (CPU_BASED_CR3_LOAD_EXITING | CPU_BASED_CR3_STORE_EXITING)); vcpu->arch.cr0 =3D cr0; @@ -1448,7 +1448,7 @@ static void ept_update_paging_mode_cr0(unsigned long= =20 *hw_cr0, } else if (!is_paging(vcpu)) { /* From nonpaging to paging */ vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, =2D vmcs_config.cpu_based_exec_ctrl & + vmcs_read32(CPU_BASED_VM_EXEC_CONTROL) & ~(CPU_BASED_CR3_LOAD_EXITING | CPU_BASED_CR3_STORE_EXITING)); vcpu->arch.cr0 =3D cr0; =2D- 1.5.5 --Boundary-00=_86KWIftwD0RfDKG Content-Type: text/x-diff; charset="utf-8"; name="0001-KVM-VMX-Fix-a-wrong-usage-of-vmcs_config.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-KVM-VMX-Fix-a-wrong-usage-of-vmcs_config.patch" =46rom a1c929709718c015686b0c23046cc08b8bc47a62 Mon Sep 17 00:00:00 2001 =46rom: Sheng Yang Date: Wed, 18 Jun 2008 14:43:38 +0800 Subject: [PATCH] KVM: VMX: Fix a wrong usage of vmcs_config The function ept_update_paging_mode_cr0() write to CPU_BASED_VM_EXEC_CONTROL based on vmcs_config.cpu_based_exec_ctrl. That's wrong because the variable may not consistent with the content in the CPU_BASE_VM_EXEC_CONTROL MSR. Signed-off-by: Sheng Yang =2D-- arch/x86/kvm/vmx.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 6e4278d..6a31406 100644 =2D-- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1438,7 +1438,7 @@ static void ept_update_paging_mode_cr0(unsigned long = *hw_cr0, if (!(cr0 & X86_CR0_PG)) { /* From paging/starting to nonpaging */ vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, =2D vmcs_config.cpu_based_exec_ctrl | + vmcs_read32(CPU_BASED_VM_EXEC_CONTROL) | (CPU_BASED_CR3_LOAD_EXITING | CPU_BASED_CR3_STORE_EXITING)); vcpu->arch.cr0 =3D cr0; @@ -1448,7 +1448,7 @@ static void ept_update_paging_mode_cr0(unsigned long = *hw_cr0, } else if (!is_paging(vcpu)) { /* From nonpaging to paging */ vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, =2D vmcs_config.cpu_based_exec_ctrl & + vmcs_read32(CPU_BASED_VM_EXEC_CONTROL) & ~(CPU_BASED_CR3_LOAD_EXITING | CPU_BASED_CR3_STORE_EXITING)); vcpu->arch.cr0 =3D cr0; =2D-=20 1.5.5 --Boundary-00=_86KWIftwD0RfDKG--