kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	kvm-ppc@vger.kernel.org, kvm@vger.kernel.org,
	Paolo Bonzini <pbonzini@redhat.com>,
	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 08:14:19 +0100	[thread overview]
Message-ID: <f63cbdf4-85c1-d3ac-a73d-726abdba326d@kaod.org> (raw)
In-Reply-To: <1518128353.2312.217.camel@kernel.crashing.org>

On 02/08/2018 11:19 PM, Benjamin Herrenschmidt wrote:
> On Thu, 2018-02-08 at 17:03 +0100, Cédric Le Goater wrote:
>>  
>> +/*
>> + * Stolen from virt/kvm/kvm_main.c
>> + */
> 
> Just export it. It's annoying that we can't just ues hva_to_pfn() ...

yes. I might add a kvm_ prefix. I will check to see what is the
best pratice.

[ ... ]

>> @@ -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.

Thanks,

C. 

  reply	other threads:[~2018-02-09  7:14 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 [this message]
2018-02-09 15:01     ` Paolo Bonzini
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=f63cbdf4-85c1-d3ac-a73d-726abdba326d@kaod.org \
    --to=clg@kaod.org \
    --cc=benh@kernel.crashing.org \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=pbonzini@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 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).