xen/arm: mm: flush_page_to_ram() only need to clean to PoC
authorJulien Grall <jgrall@amazon.com>
Sat, 20 Feb 2021 17:54:13 +0000 (17:54 +0000)
committerJulien Grall <jgrall@amazon.com>
Thu, 1 Apr 2021 16:12:05 +0000 (17:12 +0100)
commit9617d5f9c19d1d157629e1e436791509526e0ce5
tree68a88ec9e5e9acacc833a0216336a1d8b49d2774
parent5c3c410bd2ea8d2cc520e8e8f83ad143c9c5cff7
xen/arm: mm: flush_page_to_ram() only need to clean to PoC

At the moment, flush_page_to_ram() is both cleaning and invalidate to
PoC the page.

The goal of flush_page_to_ram() is to prevent corruption when the guest
has disabled the cache (the cache line may be dirty) and the guest to
read previous content.

Per this definition, the invalidating the line is not necessary. So
invalidating the cache is unnecessary. In fact, it may be counter-
productive as the line may be (speculatively) accessed a bit after.
So this will incurr an expensive access to the memory.

More generally, we should avoid interferring too much with cache.
Therefore, flush_page_to_ram() is updated to only clean to PoC the page.

The performance impact of this change will depend on your
workload/processor.

Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/mm.c