diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2009-06-17 09:53:47 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-06-28 07:10:29 -0400 |
commit | 84261923d3dddb766736023bead6fa07b7e218d5 (patch) | |
tree | 23a0c4af14dd9c548c5bcb457c74fdd980e2312e /include | |
parent | 29a4b9333bf9ffef12b3dd7cbf2e3dbe01152968 (diff) |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/kvm_host.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index aacc5449f586..16713dc672e4 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -125,6 +125,7 @@ struct kvm_kernel_irq_routing_entry { | |||
125 | struct kvm { | 125 | struct kvm { |
126 | struct mutex lock; /* protects the vcpus array and APIC accesses */ | 126 | struct mutex lock; /* protects the vcpus array and APIC accesses */ |
127 | spinlock_t mmu_lock; | 127 | spinlock_t mmu_lock; |
128 | spinlock_t requests_lock; | ||
128 | struct rw_semaphore slots_lock; | 129 | struct rw_semaphore slots_lock; |
129 | struct mm_struct *mm; /* userspace tied to this vm */ | 130 | struct mm_struct *mm; /* userspace tied to this vm */ |
130 | int nmemslots; | 131 | int nmemslots; |