diff options
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/kvm_main.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 2907d05cfcc3..cd34f73513d3 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -723,9 +723,6 @@ unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn) | |||
723 | } | 723 | } |
724 | EXPORT_SYMBOL_GPL(gfn_to_hva); | 724 | EXPORT_SYMBOL_GPL(gfn_to_hva); |
725 | 725 | ||
726 | /* | ||
727 | * Requires current->mm->mmap_sem to be held | ||
728 | */ | ||
729 | pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn) | 726 | pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn) |
730 | { | 727 | { |
731 | struct page *page[1]; | 728 | struct page *page[1]; |
@@ -741,20 +738,23 @@ pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn) | |||
741 | return page_to_pfn(bad_page); | 738 | return page_to_pfn(bad_page); |
742 | } | 739 | } |
743 | 740 | ||
744 | npages = get_user_pages(current, current->mm, addr, 1, 1, 0, page, | 741 | npages = get_user_pages_fast(addr, 1, 1, page); |
745 | NULL); | ||
746 | 742 | ||
747 | if (unlikely(npages != 1)) { | 743 | if (unlikely(npages != 1)) { |
748 | struct vm_area_struct *vma; | 744 | struct vm_area_struct *vma; |
749 | 745 | ||
746 | down_read(¤t->mm->mmap_sem); | ||
750 | vma = find_vma(current->mm, addr); | 747 | vma = find_vma(current->mm, addr); |
748 | |||
751 | if (vma == NULL || addr < vma->vm_start || | 749 | if (vma == NULL || addr < vma->vm_start || |
752 | !(vma->vm_flags & VM_PFNMAP)) { | 750 | !(vma->vm_flags & VM_PFNMAP)) { |
751 | up_read(¤t->mm->mmap_sem); | ||
753 | get_page(bad_page); | 752 | get_page(bad_page); |
754 | return page_to_pfn(bad_page); | 753 | return page_to_pfn(bad_page); |
755 | } | 754 | } |
756 | 755 | ||
757 | pfn = ((addr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; | 756 | pfn = ((addr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; |
757 | up_read(¤t->mm->mmap_sem); | ||
758 | BUG_ON(!is_mmio_pfn(pfn)); | 758 | BUG_ON(!is_mmio_pfn(pfn)); |
759 | } else | 759 | } else |
760 | pfn = page_to_pfn(page[0]); | 760 | pfn = page_to_pfn(page[0]); |