KVM: arm64: Move guest CMOs to the fault handlers
authorYanan Wang <wangyanan55@huawei.com>
Thu, 17 Jun 2021 10:58:24 +0000 (18:58 +0800)
committerMarc Zyngier <maz@kernel.org>
Fri, 18 Jun 2021 11:35:35 +0000 (12:35 +0100)
commit25aa28691bb960a76f0cffd8862144a29487f6ff
tree82a2838a63b02da88a43184b6871d777fffe4ac2
parent378e6a9c78a02b4b609846aa0afccf34d3038977
KVM: arm64: Move guest CMOs to the fault handlers

We currently uniformly perform CMOs of D-cache and I-cache in function
user_mem_abort before calling the fault handlers. If we get concurrent
guest faults(e.g. translation faults, permission faults) or some really
unnecessary guest faults caused by BBM, CMOs for the first vcpu are
necessary while the others later are not.

By moving CMOs to the fault handlers, we can easily identify conditions
where they are really needed and avoid the unnecessary ones. As it's a
time consuming process to perform CMOs especially when flushing a block
range, so this solution reduces much load of kvm and improve efficiency
of the stage-2 page table code.

We can imagine two specific scenarios which will gain much benefit:
1) In a normal VM startup, this solution will improve the efficiency of
handling guest page faults incurred by vCPUs, when initially populating
stage-2 page tables.
2) After live migration, the heavy workload will be resumed on the
destination VM, however all the stage-2 page tables need to be rebuilt
at the moment. So this solution will ease the performance drop during
resuming stage.

Reviewed-by: Fuad Tabba <tabba@google.com>
Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210617105824.31752-5-wangyanan55@huawei.com
arch/arm64/kvm/hyp/pgtable.c
arch/arm64/kvm/mmu.c