kvm.vger.kernel.org archive mirror
 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: Mon, 12 Feb 2018 21:54:49 +1100	[thread overview]
Message-ID: <1518432889.2959.18.camel@kernel.crashing.org> (raw)
In-Reply-To: <c7468f95-f451-038f-6ddb-ca7511beabd4@redhat.com>

On Mon, 2018-02-12 at 11:41 +0100, Paolo Bonzini wrote:
> On 12/02/2018 11:33, Benjamin Herrenschmidt wrote:
> > My limited understanding
> > right now is that we set it via gup on a write fault in the struct
> > page, and it can only be cleared via page_mkclean which takes the
> > mapping out. But I haven't checked that this is 100% tight (meaning we 
> > don't actually rely on the 2nd level page table dirty bit except for
> > dirty_map tracking).
> 
> Yeah, 2nd-level page tables only use dirty bits internally for KVM's
> dirty page logging (if it's active) or don't use them at all.

Ok.

> In fact I don't know about PPC but on x86 we actually do
> write-protection except on the newest processors that have a dirty page
> _log_ in addition to the bits.

Can you explain ? I'm not sure I got what you mean here.

>   With the bits only, scanning the page
> tables and clearing the bits atomically one page at a time is incredibly
> slow and hits the cache really badly.  With write protection, each fault
> is slower but KVM_GET_DIRTY_LOG is hundreds of times faster.  And
> slowing down accesses to dirty pages might actually _help_ migration
> converge---it's not a bug, it's a feature! :)
> 
> > > See the untested/uncompiled patch below the signature for some ideas.
> > 
> > I can give that a spin tomorrow with a bit of luck (30 other things on
> > my plate), or maybe Paul can.
> > 
> > BTW. Is there some doc/explanation about the whole Async page fault
> > business ? What is it about ? I wonder if it's something we
> > could/should use as well.
> 
> Quite likely since it was stolen from pHyp.
> 
> The idea is that you tell the guest about _host_ page faults and the
> guest starts running some other process.  Then when the host page fault
> is resolved, you tell the guest about that as well.  This way host page
> faults are resolved without blocking the whole guest.

Not pHyp then, I don't think we have any such thing on PAPR, you are
probably thinking about s390 ?

How do you tell the guest on x86 ? You synthetize some kind of
artificial interrupt ? There's a paravirt stuff for the guest to tell
you it knows about it ? Or some other mechanism ?

For powerpc, we could do something similar fairly easily since we are
paravirtualized but I'd like to see how that's plumbed into the exist
archs who use it so we don't diverge too much.

Cheers,
Ben.

  reply	other threads:[~2018-02-12 10:55 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
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 [this message]
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=1518432889.2959.18.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 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).