Skip to contentSkip to conversation

KVM: Remove async parameter for hva_to_pfn_remapped()

PATCH In review Peter Xu 2 participants 3 messages Apr 16, 2020 KVM

lore
Share & tools
lore

Peter Xu

author
#0 lore raw

PATCH 1/1 KVM: Remove async parameter for hva_to_pfn_remapped()

We always do synchronous fault in for those pages.

---

Or, does it make sense to allow async pf for PFNMAP|IO too? I just didn't figure out why not...

---
 virt/kvm/kvm_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
virt/kvm/kvm_main.c +2 -2
index 74bdb7bf3295..2f1f2f56e93d 100644
@@ -1807,7 +1807,7 @@ static bool vma_is_valid(struct vm_area_struct *vma, bool write_fault)
 }
 
 static int hva_to_pfn_remapped(struct vm_area_struct *vma,
-			       unsigned long addr, bool *async,
+			       unsigned long addr,
 			       bool write_fault, bool *writable,
 			       kvm_pfn_t *p_pfn)
 {
@@ -1902,7 +1902,7 @@ static kvm_pfn_t hva_to_pfn(unsigned long addr, bool atomic, bool *async,
 	if (vma == NULL)
 		pfn = KVM_PFN_ERR_FAULT;
 	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, write_fault, writable, &pfn);
 		if (r == -EAGAIN)
 			goto retry;
 		if (r < 0)
Signature · 1 line
2.24.1
maintainer
#1 lore raw
Quoted 8 lines · Peter Xu

We always do synchronous fault in for those pages.

---

Or, does it make sense to allow async pf for PFNMAP|IO too? I just didn't figure out why not...
---

I think async pf would use FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_RETRY_NOWAIT. On failure you would set *async = true.

In practice I don't think fixup_user_fault is likely to do anything asynchronously.

Paolo

author
#2 lore raw
Quoted 10 lines · Paolo Bonzini
Quoted 8 lines · Peter Xu

We always do synchronous fault in for those pages.

---

Or, does it make sense to allow async pf for PFNMAP|IO too? I just didn't figure out why not...
---

Quoted 5 lines

I think async pf would use FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_RETRY_NOWAIT. On failure you would set *async = true.

In practice I don't think fixup_user_fault is likely to do anything asynchronously.

Yeah, I'm thinking whether the fixup_user_fault() could need time to finish sometimes (IIUC that's major for the GPU drivers? I have no idea, e.g., how long time it'll take normally for a major fault), then whether we can also do that in another thread like what we do with normal anonymous pages when it was swapped out.

Thanks,

Signature · 1 line
Peter Xu