Skip to contentSkip to conversation

KVM: MMU: kvm_pv_mmu_op should not take mmap_sem

PATCH Applied Marcelo Tosatti 2 participants 2 messages Apr 16, 2008 – Apr 20, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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.

arch/x86/kvm/mmu.c +0 -3
index 078a7f1..2ad6f54 100644
@@ -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;
 }
 

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

Applied
#1 lore raw
Quoted 6 lines · Marcelo Tosatti

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.

Applied, thanks.

Signature · 8 lines
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone