kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Cédric Le Goater" <clg@kaod.org>,
	"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
	kvm-ppc@vger.kernel.org, kvm@vger.kernel.org,
	"Paul Mackerras" <paulus@samba.org>
Subject: Re: [RFC PATCH] KVM: PPC: Book3S HV: add support for page faults in VM_IO|VM_PFNMAP vmas
Date: Fri, 9 Feb 2018 16:01:16 +0100	[thread overview]
Message-ID: <b1fc885d-7c3a-18e4-2f48-71ec436b8953@redhat.com> (raw)
In-Reply-To: <f63cbdf4-85c1-d3ac-a73d-726abdba326d@kaod.org>

On 09/02/2018 08:14, Cédric Le Goater wrote:
>>> @@ -402,8 +450,15 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
>>>                 vma = find_vma(current->mm, hva);
>>>                 if (vma && vma->vm_start <= hva && hva < vma->vm_end &&
>>>                     (vma->vm_flags & VM_PFNMAP)) {
>>> -                       pfn = vma->vm_pgoff +
>>> -                               ((hva - vma->vm_start) >> PAGE_SHIFT);
>>> +                       if (vma->vm_flags & (VM_IO | VM_PFNMAP)) {
>>> +                               ret = hva_to_pfn_remapped(vma, hva, writing,
>>> +                                                         &pfn);
>>> +                               if (ret == -EAGAIN)
>>> +                                       return RESUME_GUEST;
>>> +                       } else {
>>> +                               pfn = vma->vm_pgoff +
>>> +                                       ((hva - vma->vm_start) >> PAGE_SHIFT);
>>> +                       }
>> I don't think the else case is useful. If fact you are checking
>> VM_PFNMAP twice...
> yes. I am not sure what the VM_PFNMAP case does. The code comes 
> from kvmppc_book3s_hv_page_fault() I suppose.

Maybe the outer check should be for VM_IO|VM_PFNMAP?

(Also, why is this code reinventing most of hva_to_pfn?  Not asking you
to fix that of course, but perhaps there's something to improve in the
generic code too).

Thanks,

Paolo

  reply	other threads:[~2018-02-09 15:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-08 16:03 [RFC PATCH] KVM: PPC: Book3S HV: add support for page faults in VM_IO|VM_PFNMAP vmas Cédric Le Goater
2018-02-08 22:19 ` Benjamin Herrenschmidt
2018-02-09  7:14   ` Cédric Le Goater
2018-02-09 15:01     ` Paolo Bonzini [this message]
2018-02-09 21:44       ` Benjamin Herrenschmidt
2018-02-12  9:57         ` Paolo Bonzini
2018-02-12 10:33           ` Benjamin Herrenschmidt
2018-02-12 10:41             ` Paolo Bonzini
2018-02-12 10:54               ` Benjamin Herrenschmidt
2018-02-12 11:01                 ` Paolo Bonzini
2018-02-12 14:38                   ` Benjamin Herrenschmidt
2018-02-12 14:41                     ` Paolo Bonzini
2018-02-09 21:54     ` Benjamin Herrenschmidt

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=b1fc885d-7c3a-18e4-2f48-71ec436b8953@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=benh@kernel.crashing.org \
    --cc=clg@kaod.org \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=paulus@samba.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).