diff options
Diffstat (limited to 'virt/kvm')
-rw-r--r-- | virt/kvm/kvm_main.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 013a5b3e9f75..2884baf1d5f9 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -746,6 +746,7 @@ static bool make_all_cpus_request(struct kvm *kvm, unsigned int req) | |||
746 | cpumask_clear(cpus); | 746 | cpumask_clear(cpus); |
747 | 747 | ||
748 | me = get_cpu(); | 748 | me = get_cpu(); |
749 | spin_lock(&kvm->requests_lock); | ||
749 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { | 750 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { |
750 | vcpu = kvm->vcpus[i]; | 751 | vcpu = kvm->vcpus[i]; |
751 | if (!vcpu) | 752 | if (!vcpu) |
@@ -762,6 +763,7 @@ static bool make_all_cpus_request(struct kvm *kvm, unsigned int req) | |||
762 | smp_call_function_many(cpus, ack_flush, NULL, 1); | 763 | smp_call_function_many(cpus, ack_flush, NULL, 1); |
763 | else | 764 | else |
764 | called = false; | 765 | called = false; |
766 | spin_unlock(&kvm->requests_lock); | ||
765 | put_cpu(); | 767 | put_cpu(); |
766 | free_cpumask_var(cpus); | 768 | free_cpumask_var(cpus); |
767 | return called; | 769 | return called; |
@@ -982,6 +984,7 @@ static struct kvm *kvm_create_vm(void) | |||
982 | kvm->mm = current->mm; | 984 | kvm->mm = current->mm; |
983 | atomic_inc(&kvm->mm->mm_count); | 985 | atomic_inc(&kvm->mm->mm_count); |
984 | spin_lock_init(&kvm->mmu_lock); | 986 | spin_lock_init(&kvm->mmu_lock); |
987 | spin_lock_init(&kvm->requests_lock); | ||
985 | kvm_io_bus_init(&kvm->pio_bus); | 988 | kvm_io_bus_init(&kvm->pio_bus); |
986 | mutex_init(&kvm->lock); | 989 | mutex_init(&kvm->lock); |
987 | kvm_io_bus_init(&kvm->mmio_bus); | 990 | kvm_io_bus_init(&kvm->mmio_bus); |