All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Alexander Graf <agraf@suse.de>
Cc: "Passera, Pablo R" <pablo.r.passera@intel.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: Checking  guest memory pages changes from host userspace
Date: Sun, 21 Jun 2009 23:01:10 +0300	[thread overview]
Message-ID: <4A3E9186.8020303@redhat.com> (raw)
In-Reply-To: <3574F699-DC93-41EB-9ABC-F246CCE28203@suse.de>

On 06/21/2009 09:46 PM, Alexander Graf wrote:
>> You can use the dirty memory logging API.  vga uses this to track 
>> which regions of the screen have changed, and live migration uses it 
>> to allow the guest to proceed while copying its memory to the other 
>> node.  It works exactly by write protecting guest memory and trapping 
>> the resultant fault.
>
>
> I stumbled across this on my ppc implementation: Is there an obvious 
> reason we don't use the pte's dirty bit?


Yes:

> I don't know which operation is more frequent - writing into dirty 
> mapped memory or reading the dirty map. And I have no idea how long it 
> would take to find out dirty pages...

The cost of write protection is one fault per dirtied spte.  The cost of 
looking at the dirty bit is a cache miss per spte (could be reduced by 
scanning in spte order rather than gfn order).

The problem is when you have a low percentage of memory dirtied.  Then 
you're scanning a lot of sptes to find a few dirty ones - so the cost 
per dirty page goes up.

We've talked about write-protecting the upper levels first, but given a 
random distribution of writes, that doesn't help much.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


  reply	other threads:[~2009-06-21 20:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-19 18:09 Checking guest memory pages changes from host userspace Passera, Pablo R
2009-06-20  6:47 ` Amit Shah
2009-06-21 15:51 ` Avi Kivity
2009-06-21 18:46   ` Alexander Graf
2009-06-21 20:01     ` Avi Kivity [this message]
2009-06-22  8:50       ` Avi Kivity
2009-06-22  9:42         ` Alexander Graf
2009-06-22  9:48           ` Avi Kivity
     [not found]             ` <DC72E7E7-2494-48BF-96C6-F543A29888B1@suse.de>
2009-06-22 11:38               ` Avi Kivity

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=4A3E9186.8020303@redhat.com \
    --to=avi@redhat.com \
    --cc=agraf@suse.de \
    --cc=kvm@vger.kernel.org \
    --cc=pablo.r.passera@intel.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.