Re: [PATCH 11/17] KVM: x86/mmu: Fold set_external_spte_present() into its sole caller

Huang, Kai
2026-03-31T10:37:02Z

On Fri, 2026-03-27 at 13:14 -0700, Rick Edgecombe wrote:
> From: Sean Christopherson <seanjc@google.com>
>
> Fold set_external_spte_present() into __tdp_mmu_set_spte_atomic() as all

Fold .. into __handle_changed_spte()?

> the other functionality besides calling the op.
>

all the other functionality besides calling the op is gone?

> It now is a single line
> helper that is called once.
>
> No functional change intended.
>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
> ---
> arch/x86/kvm/mmu/tdp_mmu.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
> index 6763537098ee..85c92aec868f 100644
> --- a/arch/x86/kvm/mmu/tdp_mmu.c
> +++ b/arch/x86/kvm/mmu/tdp_mmu.c
> @@ -494,13 +494,6 @@ static void handle_removed_pt(struct kvm *kvm, tdp_ptep_t pt, bool shared)
> call_rcu(&sp->rcu_head, tdp_mmu_free_sp_rcu_callback);
> }
>
> -static int __must_check set_external_spte_present(struct kvm *kvm,
> - gfn_t gfn, u64 old_spte,
> - u64 new_spte, int level)
> -{
> - return kvm_x86_call(set_external_spte)(kvm, gfn, level, new_spte);
> -}
> -
> /**
> * __handle_changed_spte - handle bookkeeping associated with an SPTE change
> * @kvm: kvm instance
> @@ -600,7 +593,7 @@ static int __handle_changed_spte(struct kvm *kvm, struct kvm_mmu_page *sp,
> (is_leaf || !is_present || WARN_ON_ONCE(pfn_changed))) {
> handle_removed_pt(kvm, spte_to_child_pt(old_spte, level), shared);
> } else if (is_mirror_sp(sp) && is_present) {
> - r = set_external_spte_present(kvm, gfn, old_spte, new_spte, level);
> + r = kvm_x86_call(set_external_spte)(kvm, gfn, level, new_spte);
> if (r)
> return r;
> }