Commit 5b494aea authored by Peter Xu's avatar Peter Xu Committed by Paolo Bonzini

KVM: No need to retry for hva_to_pfn_remapped()

hva_to_pfn_remapped() calls fixup_user_fault(), which has already
handled the retry gracefully.  Even if "unlocked" is set to true, it
means that we've got a VM_FAULT_RETRY inside fixup_user_fault(),
however the page fault has already retried and we should have the pfn
set correctly.  No need to do that again.
Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
Message-Id: <20200416155906.267462-1-peterx@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent dd03bcaa
...@@ -1831,8 +1831,6 @@ static int hva_to_pfn_remapped(struct vm_area_struct *vma, ...@@ -1831,8 +1831,6 @@ static int hva_to_pfn_remapped(struct vm_area_struct *vma,
r = fixup_user_fault(current, current->mm, addr, r = fixup_user_fault(current, current->mm, addr,
(write_fault ? FAULT_FLAG_WRITE : 0), (write_fault ? FAULT_FLAG_WRITE : 0),
&unlocked); &unlocked);
if (unlocked)
return -EAGAIN;
if (r) if (r)
return r; return r;
...@@ -1903,15 +1901,12 @@ static kvm_pfn_t hva_to_pfn(unsigned long addr, bool atomic, bool *async, ...@@ -1903,15 +1901,12 @@ static kvm_pfn_t hva_to_pfn(unsigned long addr, bool atomic, bool *async,
goto exit; goto exit;
} }
retry:
vma = find_vma_intersection(current->mm, addr, addr + 1); vma = find_vma_intersection(current->mm, addr, addr + 1);
if (vma == NULL) if (vma == NULL)
pfn = KVM_PFN_ERR_FAULT; pfn = KVM_PFN_ERR_FAULT;
else if (vma->vm_flags & (VM_IO | VM_PFNMAP)) { else if (vma->vm_flags & (VM_IO | VM_PFNMAP)) {
r = hva_to_pfn_remapped(vma, addr, async, write_fault, writable, &pfn); r = hva_to_pfn_remapped(vma, addr, async, write_fault, writable, &pfn);
if (r == -EAGAIN)
goto retry;
if (r < 0) if (r < 0)
pfn = KVM_PFN_ERR_FAULT; pfn = KVM_PFN_ERR_FAULT;
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment