This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-changelog] [xen-unstable] [HVM][VMX] Clear vmxe when VMX is not ena

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [HVM][VMX] Clear vmxe when VMX is not enabled.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 29 Sep 2006 12:50:16 +0000
Delivery-date: Sat, 30 Sep 2006 05:52:58 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID bcd0e18f7881edee8ef8cd915cdf000ec84a2468
# Parent  be78be7009c55c1f8bbaf0cb90283d1aa71627fb
[HVM][VMX] Clear vmxe when VMX is not enabled.

The current Xen code keeps X86_CR4_VMXE set even if VMXON has not been
executed. The stop_vmx() code assumes that it is possible to call
VMXOFF if X86_CR4_VMXE is set which is not always true. Calling VMXOFF
without VMXON results in an illegal opcode trap, and to avoid this condition
this patch makes sure that X86_CR4_VMXE is only set when VMXON has
been called.

Tested using x86_32 on a Pentium D 930.

Signed-Off-By: Magnus Damm <magnus@xxxxxxxxxxxxx>
 xen/arch/x86/hvm/vmx/vmx.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff -r be78be7009c5 -r bcd0e18f7881 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Fri Sep 29 11:22:24 2006 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Fri Sep 29 11:26:33 2006 +0100
@@ -485,8 +485,10 @@ static void vmx_ctxt_switch_to(struct vc
 static void stop_vmx(void)
-    if (read_cr4() & X86_CR4_VMXE)
-        __vmxoff();
+    if ( !(read_cr4() & X86_CR4_VMXE) )
+        return;
+    __vmxoff();
+    clear_in_cr4(X86_CR4_VMXE);
 void vmx_migrate_timers(struct vcpu *v)
@@ -806,12 +808,14 @@ int start_vmx(void)
     if ( (vmcs = vmx_alloc_host_vmcs()) == NULL )
+        clear_in_cr4(X86_CR4_VMXE);
         printk("Failed to allocate host VMCS\n");
         return 0;
     if ( __vmxon(virt_to_maddr(vmcs)) )
+        clear_in_cr4(X86_CR4_VMXE);
         printk("VMXON failed\n");
         return 0;

Xen-changelog mailing list

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [HVM][VMX] Clear vmxe when VMX is not enabled., Xen patchbot-unstable <=