KVM: arm64: Avoid BBM when changing only s/w bits in Stage-2 PTE
authorWill Deacon <will@kernel.org>
Tue, 23 Apr 2024 15:05:16 +0000 (16:05 +0100)
committerMarc Zyngier <maz@kernel.org>
Wed, 1 May 2024 15:46:58 +0000 (16:46 +0100)
commit7cc1d214a6cd39d7af13f931c8134c24e33dd7f6
tree93dca87e4d9453ad43f5b92024f74d9b2ddc6ac2
parent96171cfa55d0a58048ef7dada507141daa400027
KVM: arm64: Avoid BBM when changing only s/w bits in Stage-2 PTE

Break-before-make (BBM) can be expensive, as transitioning via an
invalid mapping (i.e. the "break" step) requires the completion of TLB
invalidation and can also cause other agents to fault concurrently on
the invalid mapping.

Since BBM is not required when changing only the software bits of a PTE,
avoid the sequence in this case and just update the PTE directly.

Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Fuad Tabba <tabba@google.com>
Acked-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20240423150538.2103045-9-tabba@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/hyp/pgtable.c