KVM: MMU: kvm_pv_mmu_op should not take mmap_sem
authorMarcelo Tosatti <mtosatti@redhat.com>
Wed, 16 Apr 2008 20:19:06 +0000 (17:19 -0300)
committerAvi Kivity <avi@qumranet.com>
Sun, 27 Apr 2008 15:21:45 +0000 (18:21 +0300)
kvm_pv_mmu_op should not take mmap_sem. All gfn_to_page() callers down
in the MMU processing will take it if necessary, so as it is it can
deadlock.

Apparently a leftover from the days before slots_lock.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
arch/x86/kvm/mmu.c

index 078a7f1ac34c186a97ab31d15562ba18461be818..2ad6f5481671997c24c420b31fce7c9d67b31794 100644 (file)
@@ -2173,8 +2173,6 @@ int kvm_pv_mmu_op(struct kvm_vcpu *vcpu, unsigned long bytes,
        int r;
        struct kvm_pv_mmu_op_buffer buffer;
 
-       down_read(&current->mm->mmap_sem);
-
        buffer.ptr = buffer.buf;
        buffer.len = min_t(unsigned long, bytes, sizeof buffer.buf);
        buffer.processed = 0;
@@ -2194,7 +2192,6 @@ int kvm_pv_mmu_op(struct kvm_vcpu *vcpu, unsigned long bytes,
        r = 1;
 out:
        *ret = buffer.processed;
-       up_read(&current->mm->mmap_sem);
        return r;
 }