Re: [RFC PATCH 16/21] KVM: x86/mmu: Introduce kvm_split_boundary_leafs() to split boundary leafs
From: Yan Zhao
Date: Fri May 16 2025 - 07:48:18 EST
On Fri, May 16, 2025 at 03:46:53PM +0800, Yan Zhao wrote:
> > > + goto retry;
> > > +
> > > + sp = NULL;
> > > + /*
> > > + * Set yielded in case after splitting to a lower level,
> > > + * the new iter requires furter splitting.
> > > + */
> > > + iter.yielded = true;
> > > + *flush = true;
> > > + }
> > > +
> > > + rcu_read_unlock();
> > > +
> > > + /* Leave it here though it should be impossible for the mirror root */
> > > + if (sp)
> > > + tdp_mmu_free_sp(sp);
> >
> > What do you think about relying on tdp_mmu_split_huge_pages_root() and moving
> > this to an optimization patch at the end?
> >
> > Or what about just two calls to tdp_mmu_split_huge_pages_root() at the
> > boundaries?
> Though the two generally look like the same, relying on
> tdp_mmu_split_huge_pages_root() will create several minor changes scattering
> in tdp_mmu_split_huge_pages_root().
>
> e.g. update flush after tdp_mmu_iter_cond_resched(), check
> iter_split_required(), set "iter.yielded = true".
>
> So, it may be hard to review as a initial RFC.
>
> I prefer to do that after Paolo and Sean have taken a look of it :)
Oh, I might misunderstood your meaning.
Yes, if necessary, we can provide a separate patch at the end to combine code of
tdp_mmu_split_huge_pages_root() and tdp_mmu_split_boundary_leafs().