Skip to content

KVM: x86/mmu: .change_pte() optimization in TDP MMU

Yan Zhao kvm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 18 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2KVM: x86/mmu: Remove dead code in .change_pte() handler in x86 TDP MMUarch/x86/kvm/mmu/tdp_mmu.c+4 -360 replies
2/2KVM: x86/mmu: prefetch SPTE directly in x86 TDP MMU's change_pte() handlerarch/x86/kvm/mmu/tdp_mmu.c+68 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] KVM: x86/mmu: .change_pte() optimization in TDP MMU

This series optmizes KVM mmu notifier.change_pte() handler in x86 TDP MMU (i.e. kvm_tdp_mmu_set_spte_gfn()) by removing old dead code and prefetching notified new PFN into SPTEs directly in the handler.

As in [1], .change_pte() has been dead code on x86 for 10+ years. Patch 1 drops the dead code in x86 TDP MMU to save cpu cycles and prepare for optimization in TDP MMU in patch 2.

Patch 2 optimizes TDP MMU's .change_pte() handler to prefetch SPTEs in the handler directly with PFN info contained in .change_pte() to avoid that each vCPU write that triggers .change_pte() must undergo twice VMExits and TDP page faults.

base-commit: fdf0eaf11452 + Sean's patch "KVM: Wrap kvm_{gfn,hva}_range.pte in a per-action union" [2]

[1]: https://lore.kernel.org/lkml/[email protected]/
[2]:
https://lore.kernel.org/lkml/[email protected]/

Yan Zhao (2):
KVM: x86/mmu: Remove dead code in .change_pte() handler in x86 TDP MMU
KVM: x86/mmu: prefetch SPTE directly in x86 TDP MMU's change_pte()
handler

 arch/x86/kvm/mmu/tdp_mmu.c | 101 +++++++++++++++++++++++++------------
 1 file changed, 68 insertions(+), 33 deletions(-)
Signature · 1 line
2.17.1