Skip to content

KVM: arm64: Reduce overhead of full S2 teardown

Marc Zyngier kvmarm linux-arm-kernel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4KVM: arm64: pgtable: Add Stage-2 unmap without TLBI primitivearch/arm64/include/asm/kvm_pgtable.h arch/arm64/include/asm/kvm_pkvm.h arch/arm64/kvm/hyp/pgtable.c +1 more+49 -92 replies
2/4KVM: arm64: MMU: Add kvm_stage2_unmap_all() helperarch/arm64/include/asm/kvm_mmu.h arch/arm64/kvm/mmu.c+16 -00 replies
3/4KVM: arm64: nv: Move full s2_mmu unmap over to kvm_stage2_unmap_all()arch/arm64/kvm/nested.c+2 -20 replies
4/4KVM: arm64: nv: Move TLBI VMALLS12E1* emulation over to kvm_stage2_unmap_all()arch/arm64/kvm/sys_regs.c+8 -100 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by.

PatchItaru Kitayama
SeriesT-b
1/4
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] KVM: arm64: Reduce overhead of full S2 teardown

Tearing down a full S2 is a pretty involved process, resulting in a lot of TLB invalidation. These TLBIs are either on a per leaf basis if the HW doesn't support range invalidation, or by top-level range if it does. Amusingly, the latter occurs even when nothing has been unmapped.

Things are made worse with NV, as we have a bucket-load of shadow S2s, and the need to invalidate them all on the back of an MMU notifier. The latter will eventually be solved by the reverse-map tracking that Wei-Lin is working on, but we need to be better at full-S2 teardown.

This small series adds a "no TLBI" unmapping primitive, which allows the caller to then whack the TLBs using a VMID-wide invalidation. This results in far fewer TLBIs, and a better recursive virtualisation as we get far fewer traps as a consequence.

This applies on top of my shadow-s2 lifetime fixes, and is expected to be a prefix to Wei-Lin's series.

Marc Zyngier (4):
KVM: arm64: pgtable: Add Stage-2 unmap without TLBI primitive
KVM: arm64: MMU: Add kvm_stage2_unmap_all() helper
KVM: arm64: nv: Move full s2_mmu unmap over to kvm_stage2_unmap_all()
KVM: arm64: nv: Move TLBI VMALLS12E1* emulation over to

    kvm_stage2_unmap_all()
 arch/arm64/include/asm/kvm_mmu.h     |  1 +
 arch/arm64/include/asm/kvm_pgtable.h | 17 +++++++++++++
 arch/arm64/include/asm/kvm_pkvm.h    |  1 +
 arch/arm64/kvm/hyp/pgtable.c         | 38 +++++++++++++++++++++-------
 arch/arm64/kvm/mmu.c                 | 15 +++++++++++
 arch/arm64/kvm/nested.c              |  4 +--
 arch/arm64/kvm/pkvm.c                |  2 ++
 arch/arm64/kvm/sys_regs.c            | 18 ++++++-------
 8 files changed, 75 insertions(+), 21 deletions(-)
Signature · 1 line
2.47.3