public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Avi Kivity <avi@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
	KVM list <kvm@vger.kernel.org>
Subject: Re: [PATCH 7/7] KVM: MMU: don't walk every parent pages while mark unsync
Date: Tue, 15 Jun 2010 09:32:25 +0800	[thread overview]
Message-ID: <4C16D829.6020500@cn.fujitsu.com> (raw)
In-Reply-To: <20100614220708.GA8658@amt.cnet>



Marcelo Tosatti wrote:

>> -	if (!sp->multimapped) {
>> -		kvm_mmu_update_unsync_bitmap(sp->parent_pte);
>> +	if (sp->unsync_children++)
>>  		return;
> 
> This looks wrong. If the sp has an unrelated children marked as 
> unsync (which increased sp->unsync_children), you stop the walk? 
> 

Marcelo,

I think it's right :-), we only walk the parents only when
sp->unsync_children is 0, since sp->unsync_children is the number bit
set in sp->unsync_child_bitmap, if sp->unsync_children > 0, we can sure
its parents already have mark unsync-child-exist, assume, for example,
have this mapping:

         / SP1
P1 -> P2
         \ SP2

[ P2 = P1.pte[0] SP1 = P2.pte[0] SP2 = P2.pte[1] ]

First, we mark SP1 unsyc, it will set:
P2.unsync_child_bitmap[0] = 1, P2.unsync_children = 1
and
P1.unsync_child_bitmap[0] = 1, P1.unsync_children = 1

Then, we mark SP2 unsync, we only need do:
P2.unsync_child_bitmap[1] = 1, P2.unsync_children = 2
no need touch P1, since the P1 is already mark pte[0] unsync-child-exist.

  reply	other threads:[~2010-06-15  1:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-11 13:28 [PATCH 1/7] KVM: MMU: rename 'page' and 'shadow_page' to 'sp' Xiao Guangrong
2010-06-11 13:29 ` [PATCH 2/7] KVM: MMU: cleanup for dirty page judgment Xiao Guangrong
2010-06-11 13:30 ` [PATCH 3/7] KVM: MMU: avoid double write protected in sync page path Xiao Guangrong
2010-06-11 13:31 ` [PATCH 4/7] KVM: MMU: don't mark pte notrap if it's just sync transient Xiao Guangrong
2010-06-11 13:32   ` [PATCH 5/7] KVM: MMU: cleanup for __mmu_unsync_walk() Xiao Guangrong
2010-06-11 13:34     ` [PATCH 6/7] KVM: MMU: clear unsync_child_bitmap completely Xiao Guangrong
2010-06-11 20:14   ` [PATCH 4/7] KVM: MMU: don't mark pte notrap if it's just sync transient Marcelo Tosatti
2010-06-12  2:38     ` Xiao Guangrong
2010-06-11 13:35 ` [PATCH 7/7] KVM: MMU: don't walk every parent pages while mark unsync Xiao Guangrong
2010-06-11 13:43   ` Xiao Guangrong
2010-06-14 22:07   ` Marcelo Tosatti
2010-06-15  1:32     ` Xiao Guangrong [this message]
2010-06-15 20:06       ` Marcelo Tosatti
2010-06-15 20:09       ` Marcelo Tosatti

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=4C16D829.6020500@cn.fujitsu.com \
    --to=xiaoguangrong@cn.fujitsu.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@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