Re: [PATCH 0/4] KVM: x86/mmu: Don't sync cached roots created for a different MMU context

From: Yosry Ahmed

Date: Fri Dec 04 2026 - 15:52:29 EST


> > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> > index 0b78c56f771b7..9289c7cd836b3 100644
> > --- a/arch/x86/kvm/mmu/mmu.c
> > +++ b/arch/x86/kvm/mmu/mmu.c
> > @@ -2576,10 +2576,7 @@ static void shadow_walk_init_using_root(struct kvm_shadow_walk_iterator *iterato
> > iterator->level = PT32E_ROOT_LEVEL;
> >
> > if (iterator->level == PT32E_ROOT_LEVEL) {
> > - /*
> > - * prev_root is currently only used for 64-bit hosts. So only
> > - * the active root_hpa is valid here.
> > - */
> > + /* PAE roots aren't cached, so only the active root is valid here */
> > if (WARN_ON_ONCE(root != vcpu->arch.mmu->root.hpa))
> > goto error;
>
> LOL, your assertion that I only agree with you when it's other people's code is
> holding true. "valid here" is confusing because I though it was saying the only
> the current root could be valid (see the out-of-sight VALID_PAGE() checks).
>
> I'm going with this, unless you hate it:

I don't hate it. But even if I do, you're gonna hate whatever I come
up with anyway so..

>
> /*
> * KVM doesn't cache PAE roots, so it should be impossible to
> * reach this point with anything other than the current root.
> */