]> git.karo-electronics.de Git - karo-tx-linux.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)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 2 Jul 2009 23:49:34 +0000 (16:49 -0700)
commit6aa8dd31fc0032e226b8a9cbe17f4e4a12fec9b9
treef1b6435b9778dcfe10e01d46f1ab5a600023cf0e
parentb80260bc792ae85b9d04279d80d003e6043be9a7
KVM: protect concurrent make_all_cpus_request

commit 84261923d3dddb766736023bead6fa07b7e218d5 upstream.

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.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
include/linux/kvm_host.h
virt/kvm/kvm_main.c