[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <564944A3.5080005@lab.ntt.co.jp>
Date: Mon, 16 Nov 2015 11:51:15 +0900
From: Takuya Yoshikawa <yoshikawa_takuya_b1@....ntt.co.jp>
To: Marcelo Tosatti <mtosatti@...hat.com>
Cc: pbonzini@...hat.com, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 05/10] KVM: x86: MMU: Use for_each_rmap_spte macro instead
of pte_list_walk()
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists