All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Cédric Le Goater" <clg@kaod.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, 09 Feb 2018 21:44:12 +0000	[thread overview]
Message-ID: <1518212652.2312.236.camel@kernel.crashing.org> (raw)
In-Reply-To: <b1fc885d-7c3a-18e4-2f48-71ec436b8953@redhat.com>

On Fri, 2018-02-09 at 16:01 +0100, Paolo Bonzini wrote:
> > > 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).

I've been wondering the same thing, which led me to try to understand
hva_to_pfn, which resulted in skull marks in the wall ;-)

So hva_to_pfn does a complicated dance around 3 or 4 different variants
of gup and it's really not obvious why, the "intent" doesn't appear to
be documented clearly. I think I somewhat figued out it relates to the
async page fault stuff but even then I don't actually know what those
are and what is their purpose :-)

But yeah, Paul's code more/less does its own thing with a simple
gup_fast, and is missing the hva_to_pfn_remapped case for VM_IO |
VM_PFNMAP. The short fix is to make hva_to_pfn_remapped exported and
use it via a fixed variant of Cedric patch.

The longer term fix might be to understand if/how we can use hva_to_pfn

Cheers,
Ben.

WARNING: multiple messages have this Message-ID (diff)
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Cédric Le Goater" <clg@kaod.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: Sat, 10 Feb 2018 08:44:12 +1100	[thread overview]
Message-ID: <1518212652.2312.236.camel@kernel.crashing.org> (raw)
In-Reply-To: <b1fc885d-7c3a-18e4-2f48-71ec436b8953@redhat.com>

On Fri, 2018-02-09 at 16:01 +0100, Paolo Bonzini wrote:
> > > 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).

I've been wondering the same thing, which led me to try to understand
hva_to_pfn, which resulted in skull marks in the wall ;-)

So hva_to_pfn does a complicated dance around 3 or 4 different variants
of gup and it's really not obvious why, the "intent" doesn't appear to
be documented clearly. I think I somewhat figued out it relates to the
async page fault stuff but even then I don't actually know what those
are and what is their purpose :-)

But yeah, Paul's code more/less does its own thing with a simple
gup_fast, and is missing the hva_to_pfn_remapped case for VM_IO |
VM_PFNMAP. The short fix is to make hva_to_pfn_remapped exported and
use it via a fixed variant of Cedric patch.

The longer term fix might be to understand if/how we can use hva_to_pfn

Cheers,
Ben.

  reply	other threads:[~2018-02-09 21:44 UTC|newest]

Thread overview: 26+ 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 16:03 ` Cédric Le Goater
2018-02-08 22:19 ` Benjamin Herrenschmidt
2018-02-08 22:19   ` Benjamin Herrenschmidt
2018-02-09  7:14   ` Cédric Le Goater
2018-02-09  7:14     ` Cédric Le Goater
2018-02-09 15:01     ` Paolo Bonzini
2018-02-09 15:01       ` Paolo Bonzini
2018-02-09 21:44       ` Benjamin Herrenschmidt [this message]
2018-02-09 21:44         ` Benjamin Herrenschmidt
2018-02-12  9:57         ` Paolo Bonzini
2018-02-12  9:57           ` Paolo Bonzini
2018-02-12 10:33           ` Benjamin Herrenschmidt
2018-02-12 10:33             ` Benjamin Herrenschmidt
2018-02-12 10:41             ` Paolo Bonzini
2018-02-12 10:41               ` Paolo Bonzini
2018-02-12 10:54               ` Benjamin Herrenschmidt
2018-02-12 10:54                 ` Benjamin Herrenschmidt
2018-02-12 11:01                 ` Paolo Bonzini
2018-02-12 11:01                   ` Paolo Bonzini
2018-02-12 14:38                   ` Benjamin Herrenschmidt
2018-02-12 14:38                     ` Benjamin Herrenschmidt
2018-02-12 14:41                     ` Paolo Bonzini
2018-02-12 14:41                       ` Paolo Bonzini
2018-02-09 21:54     ` Benjamin Herrenschmidt
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=1518212652.2312.236.camel@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=clg@kaod.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 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.