Re: [PATCH] KVM: x86: Preserve TDP MMU roots until they are explicitly invalidated

From: Sean Christopherson
Date: Fri Apr 14 2023 - 12:56:06 EST


On Fri, Apr 14, 2023, Jeremi Piotrowski wrote:
> On 4/14/2023 1:12 AM, Sean Christopherson wrote:
> > Preserve TDP MMU roots until they are explicitly invalidated by gifting
> > the TDP MMU itself a reference to a root when it is allocated. Keeping a
> > reference in the TDP MMU fixes a flaw where the TDP MMU exhibits terrible
> > performance, and can potentially even soft-hang a vCPU, if a vCPU
> > frequently unloads its roots, e.g. when KVM is emulating SMI+RSM.

...

> Thank you, I just tested this and it works wonderfully! Is this still on time for 6.3?

This is too risky for 6.3, but I am comfortable applying it for 6.4.

> In case you need it:
>
> Tested-by: Jeremi Piotrowski <jpiotrowski@xxxxxxxxxxxxxxxxxxx>
>
> I'd also like to get this backported all the way back to 5.15 because the issue is
> already present there. I tried it myself, but this was before async zap and i'm
> doing something wrong with refcounts:

For 5.15, I think our best bet is to just disable the TDP MMU by default. There
have been a _lot_ of relevant changes since 5.15, I am skeptical that this patch
can be backported to 5.15 without pulling in a big pile of changes from between
5.15 and 6.1 or so.

I added you to a related thread[*] about TDP MMU backports for 5.15, let's continue
the 5.15 discussion there.

Thanks!


[*] https://lore.kernel.org/all/ZDmEGM+CgYpvDLh6@xxxxxxxxxx