Re: [PATCH v6 09/11] KVM: TDX: Get/put PAMT pages when (un)mapping private memory

From: Edgecombe, Rick P

Date: Mon Jul 06 2026 - 17:53:30 EST


On Mon, 2026-07-06 at 14:02 -0700, Sean Christopherson wrote:
> Heh, because of course I'm omnipotent and never make mistakes.

Just using failable Sean as a tie breaker.

>
> I agree with the nit in the sense that this isn't a great pattern to encourage,
> but IMO the root of the ugly pattern is the use of kvm_get_running_vcpu() (which
> is sadly the lesser evil in this case).  I.e. I'm not terribly concerned about
> this code leading to more "problems" in the future.  And I don't really want to
> grab "tdx" later on because that deviates from the standard patterns in KVM and
> incorrectly suggests there _is_ a need to pre-check for a non-NULL vCPU.
>
> All that said, we can get the bost of both words by simply not caching "tdx";
> there's only one use anyways.

Oh yea duh, that's better.