Re: [patch 09/10] KVM: MMU: out of sync shadow core v2

Marcelo Tosatti
2008-09-22T22:52:56Z

On Mon, Sep 22, 2008 at 06:55:03PM -0300, Marcelo Tosatti wrote:
> On Mon, Sep 22, 2008 at 11:41:14PM +0300, Avi Kivity wrote:
> > Marcelo Tosatti wrote:
> >>>> + while (parent->unsync_children) {
> >>>> + for (i = 0; i < PT64_ENT_PER_PAGE; ++i) {
> >>>> + u64 ent = sp->spt[i];
> >>>> +
> >>>> + if (is_shadow_present_pte(ent)) {
> >>>> + struct kvm_mmu_page *child;
> >>>> + child = page_header(ent & PT64_BASE_ADDR_MASK);
> >>>>
> >>> What does this do?
> >>>
> >>
> >> Walks all children of given page with no efficiency. Its replaced later
> >> by the bitmap version.
> >>
> >>
> >
> > I don't understand how the variables sp, child, and parent interact. You
> > either need recursion or an explicit stack?
>
> It restarts at parent level whenever finishing any children:
>
> + if (i == PT64_ENT_PER_PAGE) {
> + sp->unsync_children = 0;
> + sp = parent;
> + }
>
> No efficiency.

Do you prefer a recursive version for this one too?