From 0b976be033c2d7ad774da341e66aa69bfdb7f0ce Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Mon, 7 Nov 2022 11:21:42 +0000 Subject: [PATCH] Disable superpage use for stage 2 arm64 mappings When modifying a stage 2 mapping we may need to call into the hypervisor to invalidate the TLB. Until it is known if the cost of this operation is less than the performance gains superpages offers disable their use. Reviewed by: kib. markj Sponsored by: Innovate UK Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37299 --- sys/arm64/arm64/pmap.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 8a73fb1c518..1fefcb491e0 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -685,8 +685,15 @@ pmap_pte_exists(pmap_t pmap, vm_offset_t va, int level, const char *diag) } bool -pmap_ps_enabled(pmap_t pmap __unused) +pmap_ps_enabled(pmap_t pmap) { + /* + * Promotion requires a hypervisor call when the kernel is running + * in EL1. To stop this disable superpage support on non-stage 1 + * pmaps for now. + */ + if (pmap->pm_stage != PM_STAGE1) + return (false); return (superpages_enabled != 0); }