From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: Re: Checking guest memory pages changes from host userspace Date: Mon, 22 Jun 2009 11:42:07 +0200 Message-ID: <5BE1911C-4100-46ED-99A5-A57AAB256AA4@suse.de> References: <18C018878FB0244EB71B7FE328978A32679FD52B@rrsmsx503.amr.corp.intel.com> <4A3E5706.9070408@redhat.com> <3574F699-DC93-41EB-9ABC-F246CCE28203@suse.de> <4A3E9186.8020303@redhat.com> <4A3F45C1.4000201@redhat.com> Mime-Version: 1.0 (Apple Message framework v935.3) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Cc: "Passera, Pablo R" , "kvm@vger.kernel.org" To: Avi Kivity Return-path: Received: from cantor2.suse.de ([195.135.220.15]:51239 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753580AbZFVJmH (ORCPT ); Mon, 22 Jun 2009 05:42:07 -0400 In-Reply-To: <4A3F45C1.4000201@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 22.06.2009, at 10:50, Avi Kivity wrote: > On 06/21/2009 11:01 PM, Avi Kivity wrote: >>> 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. >> > > Thinking about it a bit more, when we write-protect pages we're > O(spte) anyway, so that shouldn't be a barrier. Yeah, the current implementation is probably the fastest you'll get. I didn't want to slow down shadow page setup due to the dirty update, but I guess compared to the rest of the overhead that doesn't really weight as much. So I'll go with the same approach on ppc as well :-). Alex