All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Xu <peterx@redhat.com>, kvm@vger.kernel.org
Cc: Sean Christopherson <sean.j.christopherson@intel.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>
Subject: Re: [PATCH] KVM: No need to retry for hva_to_pfn_remapped()
Date: Mon, 4 May 2020 18:59:30 +0200	[thread overview]
Message-ID: <dba4f310-5838-cd78-73c9-3db84f93766a@redhat.com> (raw)
In-Reply-To: <20200416155906.267462-1-peterx@redhat.com>

On 16/04/20 17:59, Peter Xu wrote:
> 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: Peter Xu <peterx@redhat.com>
> ---
>  virt/kvm/kvm_main.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 2f1f2f56e93d..6aaed69641a5 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -1824,8 +1824,6 @@ static int hva_to_pfn_remapped(struct vm_area_struct *vma,
>  		r = fixup_user_fault(current, current->mm, addr,
>  				     (write_fault ? FAULT_FLAG_WRITE : 0),
>  				     &unlocked);
> -		if (unlocked)
> -			return -EAGAIN;
>  		if (r)
>  			return r;
>  
> @@ -1896,15 +1894,12 @@ static kvm_pfn_t hva_to_pfn(unsigned long addr, bool atomic, bool *async,
>  		goto exit;
>  	}
>  
> -retry:
>  	vma = find_vma_intersection(current->mm, addr, addr + 1);
>  
>  	if (vma == NULL)
>  		pfn = KVM_PFN_ERR_FAULT;
>  	else if (vma->vm_flags & (VM_IO | VM_PFNMAP)) {
>  		r = hva_to_pfn_remapped(vma, addr, write_fault, writable, &pfn);
> -		if (r == -EAGAIN)
> -			goto retry;
>  		if (r < 0)
>  			pfn = KVM_PFN_ERR_FAULT;
>  	} else {
> 

Queued, thanks.

Paolo


  reply	other threads:[~2020-05-04 16:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-16 15:59 [PATCH] KVM: No need to retry for hva_to_pfn_remapped() Peter Xu
2020-05-04 16:59 ` Paolo Bonzini [this message]
2020-05-08  2:25   ` Peter Xu
2020-05-08  7:07     ` Paolo Bonzini
2020-05-29  9:45     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dba4f310-5838-cd78-73c9-3db84f93766a@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=peterx@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=vkuznets@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.