[SVM] Fix an interrupt race window in the do_launch/vmrun/vmexit loop for AMD-V.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 7 Nov 2006 17:48:18 +0000 (17:48 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 7 Nov 2006 17:48:18 +0000 (17:48 +0000)
There is also some comment cleanup in this patch.

This problem found by Virtual Iron (Dave Winchell), and patch also
provided by VI.

Signed-off-by: Tom Woller <thomas.woller@amd.com>
Signed-off-by: Dave Winchell <dwinchell@virtualiron.com>
xen/arch/x86/hvm/svm/x86_32/exits.S
xen/arch/x86/hvm/svm/x86_64/exits.S

index 36fa80b68053fa8e11c1c9095b12dd18f9ebf3ce..2cd913e16b1f481e6de9dae120336edb03d19cc1 100644 (file)
@@ -34,7 +34,7 @@
  * At VMExit time the processor saves the guest selectors, esp, eip, 
  * and eflags. Therefore we don't save them, but simply decrement 
  * the kernel stack pointer to make it consistent with the stack frame 
- * at usual interruption time. The eflags of the host is not saved by VMX
+ * at usual interruption time. The eflags of the host is not saved by AMD-V
  * and we set it to the fixed value.
  *
  * We also need the room, especially because orig_eax field is used 
@@ -89,8 +89,8 @@
 #define CLGI   .byte 0x0F,0x01,0xDD
 
 ENTRY(svm_asm_do_launch)
-        sti
         CLGI                
+        sti
         GET_CURRENT(%ebx)
         movl VCPU_svm_vmcb(%ebx), %ecx
         movl 24(%esp), %eax
@@ -152,9 +152,8 @@ svm_restore_all_guest:
         call svm_intr_assist
         call svm_asid
         call svm_load_cr2
-        sti
         /* 
-         * Check if we are going back to SVM-based VM
+         * Check if we are going back to AMD-V based VM
          * By this time, all the setups in the VMCB must be complete.
          */
         jmp svm_asm_do_launch
index 823c02378d73d2044450d8630b0637c2369bef3d..0c9aa641a3d8a93a0897db38e149e3e6b426f698 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * exits.S: SVM architecture-specific exit handling.
+ * exits.S: AMD-V architecture-specific exit handling.
  * Copyright (c) 2004, Intel Corporation.
  * Copyright (c) 2005, AMD Corporation.
  *
@@ -34,7 +34,7 @@
  * At VMExit time the processor saves the guest selectors, rsp, rip, 
  * and rflags. Therefore we don't save them, but simply decrement 
  * the kernel stack pointer to make it consistent with the stack frame 
- * at usual interruption time. The rflags of the host is not saved by VMX
+ * at usual interruption time. The rflags of the host is not saved by AMD-V
  * and we set it to the fixed value.
  *
  * We also need the room, especially because orig_eax field is used 
@@ -99,8 +99,8 @@
 #define CLGI   .byte 0x0F,0x01,0xDD
 
 ENTRY(svm_asm_do_launch)
-        sti
         CLGI                
+        sti
         GET_CURRENT(%rbx)
         movq VCPU_svm_vmcb(%rbx), %rcx
         movq UREGS_rax(%rsp), %rax
@@ -165,10 +165,9 @@ svm_restore_all_guest:
         call svm_intr_assist
         call svm_asid
         call svm_load_cr2
-        sti
         /*
-         * Check if we are going back to VMX-based VM
-         * By this time, all the setups in the VMCS must be complete.
+         * Check if we are going back to AMD-V based VM
+         * By this time, all the setups in the VMCB must be complete.
          */
         jmp svm_asm_do_launch