Re: [RFC PATCH v5 09/45] KVM: x86: Rework .free_external_spt() into .reclaim_external_sp()

From: Sean Christopherson

Date: Thu Feb 05 2026 - 17:38:14 EST


On Thu, Feb 05, 2026, Yan Zhao wrote:
> On Wed, Feb 04, 2026 at 05:45:39PM +0800, Yan Zhao wrote:
> > On Wed, Jan 28, 2026 at 05:14:41PM -0800, Sean Christopherson wrote:
> > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> > > index d12ca0f8a348..b35a07ed11fb 100644
> > > --- a/arch/x86/include/asm/kvm_host.h
> > > +++ b/arch/x86/include/asm/kvm_host.h
> > > @@ -1858,8 +1858,8 @@ struct kvm_x86_ops {
> > > u64 mirror_spte);
> > >
> > > /* Update external page tables for page table about to be freed. */
> > > - int (*free_external_spt)(struct kvm *kvm, gfn_t gfn, enum pg_level level,
> > > - void *external_spt);
> > > + void (*reclaim_external_sp)(struct kvm *kvm, gfn_t gfn,
> > > + struct kvm_mmu_page *sp);
> > Do you think "free" is still better than "reclaim" though TDX actually
> > invokes tdx_reclaim_page() to reclaim it on the TDX side?
> >
> > Naming it free_external_sp can be interpreted as freeing the sp->external_spt
> > externally (vs freeing it in tdp_mmu_free_sp_rcu_callback(). This naming also
> > allows for the future possibility of freeing sp->external_spt before the HKID is
> > freed (though this is unlikely).
> Oh. I found there's a free_external_sp() in patch 20.
>
> So, maybe reclaim_external_sp() --> remove_external_spt() ?
>
> Still think "sp" is not good :)

I think my vote would be for reclaim_external_spt(). I don't like "remove", because
similar to "free", I think most readers will assume success is guaranteed.