]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit781d8f472d6199ec3a66ff0270f3c85f830fe0c8
treeec3e4aa913bcdc0f97222f7a9ee4b52104d1ed1f
parentf5a8a5e2c01b87fc7ff765daae9399d53124934e
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