Re: [PATCH] KVM: arm64: Remove redundant check for S2FWB
From: Jing Zhang <hidden>
Date: 2021-02-05 18:57:55
Also in:
kvmarm
Hi Marc, Thanks for the comment. On Fri, Feb 5, 2021 at 11:24 AM Marc Zyngier [off-list ref] wrote:
Hi Jing, On 2021-02-05 04:44, Jing Zhang wrote:quoted
Remove redundant check for CPU feature S2FWB in dcache flush code to save some CPU cycles for every memslot flush and unmapping.What CPU cycles? This is only a static branch. Can you actually measure the overhead? What does it represent in the face of a full memslot unmapping?
For CPU cycles, I mean CPU time spent for S2FWB check. For memslot unmapping, there is actually no improvement, just move the check to the stage2_unmap_walker since we removed the S2FWB check in stage2_flush_dcache. The saving is from the code path of memslot flush. The S2FWB check was in stage2_flush_dcache, in which case, for a memslot flush, the check was done for every page. Now it will save some CPU time if we do the check at a higher level, like in kvm_toggle_cache, access_dcsw, kvm_arch_prepare_memory_region. The redundant check is as follows (Only the first check is necessary): kvm_arch_prepare_memory_region -> S2FWB check -> stage2_flush_memslot -> kvm_pgtable_stage2_flush -> S2FWB check -> stage2_flush_walker -> S2FWB check -> __flush_dcache_area
Thanks,
M.
--
Jazz is not dead. It just smells funny..._______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel