xen/arm: p2m: Add support for preemption in p2m_cache_flush_range
authorJulien Grall <julien.grall@arm.com>
Mon, 26 Nov 2018 16:12:01 +0000 (16:12 +0000)
committerJulien Grall <julien.grall@arm.com>
Tue, 18 Dec 2018 17:56:29 +0000 (17:56 +0000)
commit221c2fc433904937966e40c6a2538650253b7204
tree1580049512edec1512793c5e3e41caf4f19388a1
parent068118aaba842af21f0b1025925e3a2e04808c1f
xen/arm: p2m: Add support for preemption in p2m_cache_flush_range

p2m_cache_flush_range does not yet support preemption, this may be an
issue as cleaning the cache can take a long time. While the current
caller (XEN_DOMCTL_cacheflush) does not stricly require preemption, this
will be necessary for new caller in a follow-up patch.

The preemption implemented is quite simple, a counter is incremented by:
    - 1 on region skipped
    - 10 for each page requiring a flush

When the counter reach 512 or above, we will check if preemption is
needed. If not, the counter will be reset to 0. If yes, the function
will stop, update start (to allow resuming later on) and return
-ERESTART. This allows the caller to decide how the preemption will be
done.

For now, XEN_DOMCTL_cacheflush will continue to ignore the preemption.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/domctl.c
xen/arch/arm/p2m.c
xen/include/asm-arm/p2m.h