Re: [PATCH] KVM: x86/mmu: Don't create SPTEs for addresses that aren't mappable

From: Sean Christopherson

Date: Fri Feb 20 2026 - 19:07:44 EST


On Sat, Feb 21, 2026, Rick P Edgecombe wrote:
> On Fri, 2026-02-20 at 16:54 +0000, Sean Christopherson wrote:
> > >   Which meshes with a logical analysis as well: KVM only needs to flush when
> > > > removing/changing an entry, and so should always derive the to-be-flushed
> > > > ranges using the gfn that was used to make the change.
> > >
> > > And the "bad" gfn can never have TLB entries, because KVM never creates >
> > > mappings.
>
> Oh. I was under the impression that the fault gets its GPA bits stripped and
> ends up mapping the page table mapping at a wrong different GPA.

It does (by KVM, not by hardware). The above is juyst trying to clarify that we
don't have to worry about the GFN from the fault, either.

> So if some optimized GFN targeting flush was pointed at the unstripped GPA
> then it could miss the GPA that actually got mapped and made it into the TLB.
> Anyway, it seems moot.

Yeah, we're on the same page.