direct-io.hg

changeset 10478:e6ec0eeabf77

[VMX] Fix use of VMCLEAR a little: no need if not active on any CPU.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Jun 22 15:25:18 2006 +0100 (2006-06-22)
parents dab24595e529
children f10127505d3c
files xen/arch/x86/hvm/vmx/vmcs.c
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vmcs.c	Thu Jun 22 15:10:48 2006 +0100
     1.2 +++ b/xen/arch/x86/hvm/vmx/vmcs.c	Thu Jun 22 15:25:18 2006 +0100
     1.3 @@ -74,12 +74,15 @@ static void __vmx_clear_vmcs(void *info)
     1.4  
     1.5  static void vmx_clear_vmcs(struct vcpu *v)
     1.6  {
     1.7 -    unsigned int cpu = v->arch.hvm_vmx.active_cpu;
     1.8 +    int cpu = v->arch.hvm_vmx.active_cpu;
     1.9 +
    1.10 +    if ( cpu == -1 )
    1.11 +        return;
    1.12  
    1.13 -    if ( (cpu == -1) || (cpu == smp_processor_id()) )
    1.14 -        __vmx_clear_vmcs(v);
    1.15 -    else
    1.16 -        on_selected_cpus(cpumask_of_cpu(cpu), __vmx_clear_vmcs, v, 1, 1);
    1.17 +    if ( cpu == smp_processor_id() )
    1.18 +        return __vmx_clear_vmcs(v);
    1.19 +
    1.20 +    on_selected_cpus(cpumask_of_cpu(cpu), __vmx_clear_vmcs, v, 1, 1);
    1.21  }
    1.22  
    1.23  static void vmx_load_vmcs(struct vcpu *v)
    1.24 @@ -97,6 +100,8 @@ void vmx_vmcs_enter(struct vcpu *v)
    1.25       *     context initialisation.
    1.26       *  2. VMPTRLD as soon as we context-switch to a HVM VCPU.
    1.27       *  3. VMCS destruction needs to happen later (from domain_destroy()).
    1.28 +     * We can relax this a bit if a paused VCPU always commits its
    1.29 +     * architectural state to a software structure.
    1.30       */
    1.31      if ( v == current )
    1.32          return;