KVM: arm64: Use TLBI range-based instructions for unmap
authorRaghavendra Rao Ananta <rananta@google.com>
Fri, 11 Aug 2023 04:51:27 +0000 (04:51 +0000)
committerMarc Zyngier <maz@kernel.org>
Thu, 17 Aug 2023 08:40:35 +0000 (09:40 +0100)
commit7657ea920c54218f123ddc1b572821695b669c13
tree5818b6edb888d0f559a6bb57f28d98191bb1fb11
parentdefc8cc7abf0fcee8d73e440ee02827348d060e0
KVM: arm64: Use TLBI range-based instructions for unmap

The current implementation of the stage-2 unmap walker traverses
the given range and, as a part of break-before-make, performs
TLB invalidations with a DSB for every PTE. A multitude of this
combination could cause a performance bottleneck on some systems.

Hence, if the system supports FEAT_TLBIRANGE, defer the TLB
invalidations until the entire walk is finished, and then
use range-based instructions to invalidate the TLBs in one go.
Condition deferred TLB invalidation on the system supporting FWB,
as the optimization is entirely pointless when the unmap walker
needs to perform CMOs.

Rename stage2_put_pte() to stage2_unmap_put_pte() as the function
now serves the stage-2 unmap walker specifically, rather than
acting generic.

Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230811045127.3308641-15-rananta@google.com
arch/arm64/kvm/hyp/pgtable.c