KVM: VMX: fix memory order between loading vmcs and clearing vmcs
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Wed, 28 Nov 2012 12:54:14 +0000 (20:54 +0800)
committerMarcelo Tosatti <mtosatti@redhat.com>
Thu, 29 Nov 2012 23:14:46 +0000 (21:14 -0200)
commit5a560f8b5ed361c7be783d5a671ea26ca4d6fa01
treeec3e4aa913bcdc0f97222f7a9ee4b52104d1ed1f
parente6c7d32172f10b68fa9a3be05aa1231352a52171
KVM: VMX: fix memory order between loading vmcs and clearing vmcs

vmcs->cpu indicates whether it exists on the target cpu, -1 means the vmcs
does not exist on any vcpu

If vcpu load vmcs with vmcs.cpu = -1, it can be directly added to cpu's percpu
list. The list can be corrupted if the cpu prefetch the vmcs's list before
reading vmcs->cpu. Meanwhile, we should remove vmcs from the list before
making vmcs->vcpu == -1 be visible

Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/vmx.c