diff options
author | Avi Kivity <avi@redhat.com> | 2010-02-18 04:25:22 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2010-03-01 10:36:13 -0500 |
commit | 70e335e16882df5b5d6971022e63c3603a1e8c23 (patch) | |
tree | a15adffbba25223c7232a6b349a5307cdcad48bf | |
parent | fa8273e9549b3cee2947d1aebe5242e7a25eb3de (diff) |
KVM: Convert kvm->requests_lock to raw_spinlock_t
The code relies on kvm->requests_lock inhibiting preemption.
Noted by Jan Kiszka.
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | include/linux/kvm_host.h | 2 | ||||
-rw-r--r-- | virt/kvm/kvm_main.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 3145b281de9d..a3fd0f91d943 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -161,7 +161,7 @@ struct kvm_memslots { | |||
161 | 161 | ||
162 | struct kvm { | 162 | struct kvm { |
163 | spinlock_t mmu_lock; | 163 | spinlock_t mmu_lock; |
164 | spinlock_t requests_lock; | 164 | raw_spinlock_t requests_lock; |
165 | struct mutex slots_lock; | 165 | struct mutex slots_lock; |
166 | struct mm_struct *mm; /* userspace tied to this vm */ | 166 | struct mm_struct *mm; /* userspace tied to this vm */ |
167 | struct kvm_memslots *memslots; | 167 | struct kvm_memslots *memslots; |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 0a360c26cc34..548f9253c195 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -138,7 +138,7 @@ static bool make_all_cpus_request(struct kvm *kvm, unsigned int req) | |||
138 | 138 | ||
139 | zalloc_cpumask_var(&cpus, GFP_ATOMIC); | 139 | zalloc_cpumask_var(&cpus, GFP_ATOMIC); |
140 | 140 | ||
141 | spin_lock(&kvm->requests_lock); | 141 | raw_spin_lock(&kvm->requests_lock); |
142 | me = smp_processor_id(); | 142 | me = smp_processor_id(); |
143 | kvm_for_each_vcpu(i, vcpu, kvm) { | 143 | kvm_for_each_vcpu(i, vcpu, kvm) { |
144 | if (test_and_set_bit(req, &vcpu->requests)) | 144 | if (test_and_set_bit(req, &vcpu->requests)) |
@@ -153,7 +153,7 @@ static bool make_all_cpus_request(struct kvm *kvm, unsigned int req) | |||
153 | smp_call_function_many(cpus, ack_flush, NULL, 1); | 153 | smp_call_function_many(cpus, ack_flush, NULL, 1); |
154 | else | 154 | else |
155 | called = false; | 155 | called = false; |
156 | spin_unlock(&kvm->requests_lock); | 156 | raw_spin_unlock(&kvm->requests_lock); |
157 | free_cpumask_var(cpus); | 157 | free_cpumask_var(cpus); |
158 | return called; | 158 | return called; |
159 | } | 159 | } |
@@ -409,7 +409,7 @@ static struct kvm *kvm_create_vm(void) | |||
409 | kvm->mm = current->mm; | 409 | kvm->mm = current->mm; |
410 | atomic_inc(&kvm->mm->mm_count); | 410 | atomic_inc(&kvm->mm->mm_count); |
411 | spin_lock_init(&kvm->mmu_lock); | 411 | spin_lock_init(&kvm->mmu_lock); |
412 | spin_lock_init(&kvm->requests_lock); | 412 | raw_spin_lock_init(&kvm->requests_lock); |
413 | kvm_eventfd_init(kvm); | 413 | kvm_eventfd_init(kvm); |
414 | mutex_init(&kvm->lock); | 414 | mutex_init(&kvm->lock); |
415 | mutex_init(&kvm->irq_lock); | 415 | mutex_init(&kvm->irq_lock); |