Re: [PATCH v3 11/16] KVM: TDX: Add x86 ops for external spt cache

Yan Zhao
2025-09-30T01:03:43Z

On Thu, Sep 18, 2025 at 04:22:19PM -0700, Rick Edgecombe wrote:
> if (kvm_has_mirrored_tdp(vcpu->kvm)) {
> - r = kvm_mmu_topup_memory_cache(&vcpu->arch.mmu_external_spt_cache,
> - PT64_ROOT_MAX_LEVEL);
> + r = kvm_x86_call(topup_external_fault_cache)(vcpu);
Another concern about the topup op is that it entirely hides the page count from
KVM mmu core and assumes the page table level KVM requests is always
PT64_ROOT_MAX_LEVEL.

This assumption will not hold true for split cache for huge pages, where only
a single level is needed and memory for sp, sp->spt, and sp->external_spt does
not need to be allocated from the split cache. [1].

[1] https://lore.kernel.org/all/20250807094604.4762-1-yan.y.zhao@intel.com/