]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: protect concurrent make_all_cpus_request
authorMarcelo Tosatti <mtosatti@redhat.com>
Wed, 17 Jun 2009 13:53:47 +0000 (10:53 -0300)
committerAvi Kivity <avi@redhat.com>
Sun, 28 Jun 2009 11:10:29 +0000 (14:10 +0300)
commita4301b86065f64da3eba2844da7b58908fe6f103
tree23a0c4af14dd9c548c5bcb457c74fdd980e2312e
parent4bbeb103b07a2614e353af6cbe4ac703175ed4c8
KVM: protect concurrent make_all_cpus_request

make_all_cpus_request contains a race condition which can
trigger false request completed status, as follows:

CPU0                                              CPU1

if (test_and_set_bit(req,&vcpu->requests))
   ....                                            if (test_and_set_bit(req,&vcpu->requests))
   ..                                                  return
proceed to smp_call_function_many(wait=1)

Use a spinlock to serialize concurrent CPUs.

Cc: stable@kernel.org
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
include/linux/kvm_host.h
virt/kvm/kvm_main.c