diff mbox series

KVM: Remove async parameter for hva_to_pfn_remapped()

Message ID 20200416155903.267414-1-peterx@redhat.com (mailing list archive)
State New, archived
Headers show
Series KVM: Remove async parameter for hva_to_pfn_remapped() | expand

Commit Message

Peter Xu April 16, 2020, 3:59 p.m. UTC
We always do synchronous fault in for those pages.

Signed-off-by: Peter Xu <peterx@redhat.com>
---

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(-)

Comments

Paolo Bonzini April 16, 2020, 4:13 p.m. UTC | #1
On 16/04/20 17:59, Peter Xu wrote:
> We always do synchronous fault in for those pages.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
> 
> 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
Peter Xu April 16, 2020, 4:22 p.m. UTC | #2
On Thu, Apr 16, 2020 at 06:13:57PM +0200, Paolo Bonzini wrote:
> On 16/04/20 17:59, Peter Xu wrote:
> > We always do synchronous fault in for those pages.
> > 
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> > 
> > 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.

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,
diff mbox series

Patch

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 74bdb7bf3295..2f1f2f56e93d 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -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)