Message ID | 20121204085600.25919.21644.stgit@srivatsabhat.in.ibm.com (mailing list archive) |
---|---|
State | RFC, archived |
Headers | show |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 95e502b..4fb4e51 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1019,8 +1019,15 @@ static void loaded_vmcs_clear(struct loaded_vmcs *loaded_vmcs) int cpu = loaded_vmcs->cpu; if (cpu != -1) - smp_call_function_single(cpu, - __loaded_vmcs_clear, loaded_vmcs, 1); + if (smp_call_function_single(cpu, + __loaded_vmcs_clear, loaded_vmcs, 1)) + + /* + * The target cpu is going down, we should + * wait for it to clear the vmcs status. + */ + while (ACCESS_ONCE(loaded_vmcs->cpu) != -1) + cpu_relax(); } static inline void vpid_sync_vcpu_single(struct vcpu_vmx *vmx)