ia64/xen-unstable

changeset 12292:2b89ebf00fc8

[SVM] Fix an interrupt race window in the do_launch/vmrun/vmexit loop for AMD-V.

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>
author kfraser@localhost.localdomain
date Tue Nov 07 17:48:18 2006 +0000 (2006-11-07)
parents cba947bc8450
children e32b74b2d7f4
files xen/arch/x86/hvm/svm/x86_32/exits.S xen/arch/x86/hvm/svm/x86_64/exits.S
line diff
     1.1 --- a/xen/arch/x86/hvm/svm/x86_32/exits.S	Tue Nov 07 17:46:40 2006 +0000
     1.2 +++ b/xen/arch/x86/hvm/svm/x86_32/exits.S	Tue Nov 07 17:48:18 2006 +0000
     1.3 @@ -34,7 +34,7 @@
     1.4   * At VMExit time the processor saves the guest selectors, esp, eip, 
     1.5   * and eflags. Therefore we don't save them, but simply decrement 
     1.6   * the kernel stack pointer to make it consistent with the stack frame 
     1.7 - * at usual interruption time. The eflags of the host is not saved by VMX, 
     1.8 + * at usual interruption time. The eflags of the host is not saved by AMD-V, 
     1.9   * and we set it to the fixed value.
    1.10   *
    1.11   * We also need the room, especially because orig_eax field is used 
    1.12 @@ -89,8 +89,8 @@
    1.13  #define CLGI   .byte 0x0F,0x01,0xDD
    1.14  
    1.15  ENTRY(svm_asm_do_launch)
    1.16 +        CLGI                
    1.17          sti
    1.18 -        CLGI                
    1.19          GET_CURRENT(%ebx)
    1.20          movl VCPU_svm_vmcb(%ebx), %ecx
    1.21          movl 24(%esp), %eax
    1.22 @@ -152,9 +152,8 @@ svm_restore_all_guest:
    1.23          call svm_intr_assist
    1.24          call svm_asid
    1.25          call svm_load_cr2
    1.26 -        sti
    1.27          /* 
    1.28 -         * Check if we are going back to SVM-based VM
    1.29 +         * Check if we are going back to AMD-V based VM
    1.30           * By this time, all the setups in the VMCB must be complete.
    1.31           */
    1.32          jmp svm_asm_do_launch
     2.1 --- a/xen/arch/x86/hvm/svm/x86_64/exits.S	Tue Nov 07 17:46:40 2006 +0000
     2.2 +++ b/xen/arch/x86/hvm/svm/x86_64/exits.S	Tue Nov 07 17:48:18 2006 +0000
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * exits.S: SVM architecture-specific exit handling.
     2.6 + * exits.S: AMD-V architecture-specific exit handling.
     2.7   * Copyright (c) 2004, Intel Corporation.
     2.8   * Copyright (c) 2005, AMD Corporation.
     2.9   *
    2.10 @@ -34,7 +34,7 @@
    2.11   * At VMExit time the processor saves the guest selectors, rsp, rip, 
    2.12   * and rflags. Therefore we don't save them, but simply decrement 
    2.13   * the kernel stack pointer to make it consistent with the stack frame 
    2.14 - * at usual interruption time. The rflags of the host is not saved by VMX, 
    2.15 + * at usual interruption time. The rflags of the host is not saved by AMD-V, 
    2.16   * and we set it to the fixed value.
    2.17   *
    2.18   * We also need the room, especially because orig_eax field is used 
    2.19 @@ -99,8 +99,8 @@
    2.20  #define CLGI   .byte 0x0F,0x01,0xDD
    2.21  
    2.22  ENTRY(svm_asm_do_launch)
    2.23 +        CLGI                
    2.24          sti
    2.25 -        CLGI                
    2.26          GET_CURRENT(%rbx)
    2.27          movq VCPU_svm_vmcb(%rbx), %rcx
    2.28          movq UREGS_rax(%rsp), %rax
    2.29 @@ -165,10 +165,9 @@ svm_restore_all_guest:
    2.30          call svm_intr_assist
    2.31          call svm_asid
    2.32          call svm_load_cr2
    2.33 -        sti
    2.34          /*
    2.35 -         * Check if we are going back to VMX-based VM
    2.36 -         * By this time, all the setups in the VMCS must be complete.
    2.37 +         * Check if we are going back to AMD-V based VM
    2.38 +         * By this time, all the setups in the VMCB must be complete.
    2.39           */
    2.40          jmp svm_asm_do_launch
    2.41