diff options
author | Hollis Blanchard <hollisb@us.ibm.com> | 2008-05-22 01:22:54 +0200 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-06-06 20:22:33 +0200 |
commit | 905fa4b9d6e2c9fd1c9ad84e3abe83021f498f53 (patch) | |
tree | d26440a247f76a7f0b440973621bf2ca764e6697 /arch/powerpc/kvm | |
parent | KVM: ppc: Remove unmatched kunmap() call (diff) | |
download | linux-905fa4b9d6e2c9fd1c9ad84e3abe83021f498f53.tar.xz linux-905fa4b9d6e2c9fd1c9ad84e3abe83021f498f53.zip |
KVM: ppc: Use a read lock around MMU operations, and release it on error
gfn_to_page() and kvm_release_page_clean() are called from other contexts with
mmap_sem locked only for reading.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/powerpc/kvm')
-rw-r--r-- | arch/powerpc/kvm/44x_tlb.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/powerpc/kvm/44x_tlb.c b/arch/powerpc/kvm/44x_tlb.c index aa649c7db99b..1c48d6164bd5 100644 --- a/arch/powerpc/kvm/44x_tlb.c +++ b/arch/powerpc/kvm/44x_tlb.c @@ -142,18 +142,19 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gfn_t gfn, u64 asid, stlbe = &vcpu->arch.shadow_tlb[victim]; /* Get reference to new page. */ - down_write(¤t->mm->mmap_sem); + down_read(¤t->mm->mmap_sem); new_page = gfn_to_page(vcpu->kvm, gfn); if (is_error_page(new_page)) { printk(KERN_ERR "Couldn't get guest page!\n"); kvm_release_page_clean(new_page); + up_read(¤t->mm->mmap_sem); return; } hpaddr = page_to_phys(new_page); /* Drop reference to old page. */ kvmppc_44x_shadow_release(vcpu, victim); - up_write(¤t->mm->mmap_sem); + up_read(¤t->mm->mmap_sem); vcpu->arch.shadow_pages[victim] = new_page; |