From: kaf24@firebug.cl.cam.ac.uk Date: Thu, 22 Jun 2006 14:25:18 +0000 (+0100) Subject: [VMX] Fix use of VMCLEAR a little: no need if not active on any CPU. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15921^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=df3f613e313bd5c6ebdd43d541ce262d3a2c58bd;p=xen.git [VMX] Fix use of VMCLEAR a little: no need if not active on any CPU. Signed-off-by: Keir Fraser --- diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c index 0a0fb35da3..8d498d2d03 100644 --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -74,12 +74,15 @@ static void __vmx_clear_vmcs(void *info) static void vmx_clear_vmcs(struct vcpu *v) { - unsigned int cpu = v->arch.hvm_vmx.active_cpu; + int cpu = v->arch.hvm_vmx.active_cpu; - if ( (cpu == -1) || (cpu == smp_processor_id()) ) - __vmx_clear_vmcs(v); - else - on_selected_cpus(cpumask_of_cpu(cpu), __vmx_clear_vmcs, v, 1, 1); + if ( cpu == -1 ) + return; + + if ( cpu == smp_processor_id() ) + return __vmx_clear_vmcs(v); + + on_selected_cpus(cpumask_of_cpu(cpu), __vmx_clear_vmcs, v, 1, 1); } static void vmx_load_vmcs(struct vcpu *v) @@ -97,6 +100,8 @@ void vmx_vmcs_enter(struct vcpu *v) * context initialisation. * 2. VMPTRLD as soon as we context-switch to a HVM VCPU. * 3. VMCS destruction needs to happen later (from domain_destroy()). + * We can relax this a bit if a paused VCPU always commits its + * architectural state to a software structure. */ if ( v == current ) return;