diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2009-12-23 11:35:26 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2010-03-01 10:35:45 -0500 |
commit | 79fac95ecfa3969aab8119d37ccd7226165f933a (patch) | |
tree | 4103169c7fd2b7fb1ba95dae2db6b3f365476b9d /arch/x86/kvm/x86.c | |
parent | f656ce0185cabbbb0cf96877306879661297c7ad (diff) |
KVM: convert slots_lock to a mutex
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 53bc06a68105..aff3479867a8 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -2208,14 +2208,14 @@ static int kvm_vm_ioctl_set_nr_mmu_pages(struct kvm *kvm, | |||
2208 | if (kvm_nr_mmu_pages < KVM_MIN_ALLOC_MMU_PAGES) | 2208 | if (kvm_nr_mmu_pages < KVM_MIN_ALLOC_MMU_PAGES) |
2209 | return -EINVAL; | 2209 | return -EINVAL; |
2210 | 2210 | ||
2211 | down_write(&kvm->slots_lock); | 2211 | mutex_lock(&kvm->slots_lock); |
2212 | spin_lock(&kvm->mmu_lock); | 2212 | spin_lock(&kvm->mmu_lock); |
2213 | 2213 | ||
2214 | kvm_mmu_change_mmu_pages(kvm, kvm_nr_mmu_pages); | 2214 | kvm_mmu_change_mmu_pages(kvm, kvm_nr_mmu_pages); |
2215 | kvm->arch.n_requested_mmu_pages = kvm_nr_mmu_pages; | 2215 | kvm->arch.n_requested_mmu_pages = kvm_nr_mmu_pages; |
2216 | 2216 | ||
2217 | spin_unlock(&kvm->mmu_lock); | 2217 | spin_unlock(&kvm->mmu_lock); |
2218 | up_write(&kvm->slots_lock); | 2218 | mutex_unlock(&kvm->slots_lock); |
2219 | return 0; | 2219 | return 0; |
2220 | } | 2220 | } |
2221 | 2221 | ||
@@ -2292,7 +2292,7 @@ static int kvm_vm_ioctl_set_memory_alias(struct kvm *kvm, | |||
2292 | if (!aliases) | 2292 | if (!aliases) |
2293 | goto out; | 2293 | goto out; |
2294 | 2294 | ||
2295 | down_write(&kvm->slots_lock); | 2295 | mutex_lock(&kvm->slots_lock); |
2296 | 2296 | ||
2297 | /* invalidate any gfn reference in case of deletion/shrinking */ | 2297 | /* invalidate any gfn reference in case of deletion/shrinking */ |
2298 | memcpy(aliases, kvm->arch.aliases, sizeof(struct kvm_mem_aliases)); | 2298 | memcpy(aliases, kvm->arch.aliases, sizeof(struct kvm_mem_aliases)); |
@@ -2328,7 +2328,7 @@ static int kvm_vm_ioctl_set_memory_alias(struct kvm *kvm, | |||
2328 | r = 0; | 2328 | r = 0; |
2329 | 2329 | ||
2330 | out_unlock: | 2330 | out_unlock: |
2331 | up_write(&kvm->slots_lock); | 2331 | mutex_unlock(&kvm->slots_lock); |
2332 | out: | 2332 | out: |
2333 | return r; | 2333 | return r; |
2334 | } | 2334 | } |
@@ -2462,7 +2462,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, | |||
2462 | unsigned long is_dirty = 0; | 2462 | unsigned long is_dirty = 0; |
2463 | unsigned long *dirty_bitmap = NULL; | 2463 | unsigned long *dirty_bitmap = NULL; |
2464 | 2464 | ||
2465 | down_write(&kvm->slots_lock); | 2465 | mutex_lock(&kvm->slots_lock); |
2466 | 2466 | ||
2467 | r = -EINVAL; | 2467 | r = -EINVAL; |
2468 | if (log->slot >= KVM_MEMORY_SLOTS) | 2468 | if (log->slot >= KVM_MEMORY_SLOTS) |
@@ -2512,7 +2512,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, | |||
2512 | out_free: | 2512 | out_free: |
2513 | vfree(dirty_bitmap); | 2513 | vfree(dirty_bitmap); |
2514 | out: | 2514 | out: |
2515 | up_write(&kvm->slots_lock); | 2515 | mutex_unlock(&kvm->slots_lock); |
2516 | return r; | 2516 | return r; |
2517 | } | 2517 | } |
2518 | 2518 | ||
@@ -2625,7 +2625,7 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
2625 | sizeof(struct kvm_pit_config))) | 2625 | sizeof(struct kvm_pit_config))) |
2626 | goto out; | 2626 | goto out; |
2627 | create_pit: | 2627 | create_pit: |
2628 | down_write(&kvm->slots_lock); | 2628 | mutex_lock(&kvm->slots_lock); |
2629 | r = -EEXIST; | 2629 | r = -EEXIST; |
2630 | if (kvm->arch.vpit) | 2630 | if (kvm->arch.vpit) |
2631 | goto create_pit_unlock; | 2631 | goto create_pit_unlock; |
@@ -2634,7 +2634,7 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
2634 | if (kvm->arch.vpit) | 2634 | if (kvm->arch.vpit) |
2635 | r = 0; | 2635 | r = 0; |
2636 | create_pit_unlock: | 2636 | create_pit_unlock: |
2637 | up_write(&kvm->slots_lock); | 2637 | mutex_unlock(&kvm->slots_lock); |
2638 | break; | 2638 | break; |
2639 | case KVM_IRQ_LINE_STATUS: | 2639 | case KVM_IRQ_LINE_STATUS: |
2640 | case KVM_IRQ_LINE: { | 2640 | case KVM_IRQ_LINE: { |