Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1269815

Re: [PATCH 05/10] KVM: x86: MMU: Use for_each_rmap_spte macro instead of pte_list_walk()

From Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Newsgroups linux.kernel
Subject Re: [PATCH 05/10] KVM: x86: MMU: Use for_each_rmap_spte macro instead of pte_list_walk()
Date 2015-11-16 04:00 +0100
Message-ID <qvibo-1rq-1@gated-at.bofh.it> (permalink)
References <qtYoq-8hK-11@gated-at.bofh.it> <qtYoq-8hK-9@gated-at.bofh.it> <quuHF-3K0-37@gated-at.bofh.it> <qvdbI-6N6-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2015/11/14 18:20, Marcelo Tosatti wrote:

> The actual issue is this: a higher level page that had, under its children,
> no out of sync pages, now, due to your addition, a child that is unsync:
>
> initial state:
> 	level1
>
> final state:
>
> 	level1 -x-> level2 -x-> level3
>
> Where -x-> are the links created by this pagefault fixing round.
>
> If _any_ page under you is unsync (not necessarily the ones this
> pagefault is accessing), you have to mark parents unsync.

I understand this, but I don't think my patch will break this.

What kvm_mmu_mark_parents_unsync() does is:

   for each p_i in sp->parent_ptes rmap chain
     mark_unsync(p_i);

Then, mark_unsync() finds the parent sp including that p_i to
set ->unsync_child_bitmap and increment ->unsync_children if
necessary.  It may also call kvm_mmu_mark_parents_unsync()
recursively.

I understand we need to tell the parents "you have an unsync
child/descendant" until this information reaches the top level
by that recursive calls.

But since these recursive calls cannot come back to the starting sp,
the child->parent graph has no loop, each mark_unsync(p_i) will not
be affected by other parents in that sp->parent_ptes rmap chain,
from which we started the recursive calls.


As the following code shows, my patch does mark_unsync(parent_pte)
separately, and then mmu_page_add_parent_pte(vcpu, sp, parent_pte):

> -		} else if (sp->unsync)
> +			if (parent_pte)
> +				mark_unsync(parent_pte);
> +		} else if (sp->unsync) {
>  			kvm_mmu_mark_parents_unsync(sp);
> +			if (parent_pte)
> +				mark_unsync(parent_pte);
> +		}
> +		mmu_page_add_parent_pte(vcpu, sp, parent_pte);

So, as you worried, during each mark_unsync(p_i) is processed,
this parent_pte does not exist in that sp->parent_ptes rmap chain.

But as I explained above, this does not change anything about what
each mark_unsync(p_i) call does, so keeps the original behaviour.


By the way, I think "kvm_mmu_mark_parents_unsync" and "mark_unsync"
do not tell what they actually do well. When I first saw the names,
I thought they would just set the parents' sp->unsync.

To reflect the following meaning better, it should be
propagate_unsync(_to_parents) or something:

   Tell the parents "you have an unsync child/descendant"
   until this unsync information reaches the top level


Thanks,
   Takuya


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 05/10] KVM: x86: MMU: Use for_each_rmap_spte macro instead  of pte_list_walk() Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp> - 2015-11-12 12:40 +0100
  Re: [PATCH 05/10] KVM: x86: MMU: Use for_each_rmap_spte macro  instead of pte_list_walk() Marcelo Tosatti <mtosatti@redhat.com> - 2015-11-13 23:10 +0100
    Re: [PATCH 05/10] KVM: x86: MMU: Use for_each_rmap_spte macro  instead of pte_list_walk() Marcelo Tosatti <mtosatti@redhat.com> - 2015-11-15 22:40 +0100
      Re: [PATCH 05/10] KVM: x86: MMU: Use for_each_rmap_spte macro instead  of pte_list_walk() Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp> - 2015-11-16 04:00 +0100
        Re: [PATCH 05/10] KVM: x86: MMU: Use for_each_rmap_spte macro instead  of pte_list_walk() Paolo Bonzini <pbonzini@redhat.com> - 2015-11-17 19:00 +0100
  Re: [PATCH 05/10] KVM: x86: MMU: Use for_each_rmap_spte macro instead  of pte_list_walk() Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2015-11-18 04:20 +0100

csiph-web