All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: Remove async parameter for hva_to_pfn_remapped()
@ 2020-04-16 15:59 Peter Xu
  2020-04-16 16:13 ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Xu @ 2020-04-16 15:59 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini, Sean Christopherson, Vitaly Kuznetsov, peterx

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

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: Remove async parameter for hva_to_pfn_remapped()
  2020-04-16 15:59 [PATCH] KVM: Remove async parameter for hva_to_pfn_remapped() Peter Xu
@ 2020-04-16 16:13 ` Paolo Bonzini
  2020-04-16 16:22   ` Peter Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2020-04-16 16:13 UTC (permalink / raw)
  To: Peter Xu, kvm; +Cc: Sean Christopherson, Vitaly Kuznetsov

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: Remove async parameter for hva_to_pfn_remapped()
  2020-04-16 16:13 ` Paolo Bonzini
@ 2020-04-16 16:22   ` Peter Xu
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Xu @ 2020-04-16 16:22 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, Sean Christopherson, Vitaly Kuznetsov

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,

-- 
Peter Xu


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-16 16:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16 15:59 [PATCH] KVM: Remove async parameter for hva_to_pfn_remapped() Peter Xu
2020-04-16 16:13 ` Paolo Bonzini
2020-04-16 16:22   ` Peter Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.