From adc78128b342efeb3888cc758e3b638ff9dc60a0 Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Mon, 3 Apr 2023 15:01:18 +0000 Subject: [PATCH] ANDROID: KVM: arm64: Don't recycle pages from host mem abort We're now guaranteed by construction to not require structural changes to the host stage-2 page-table from the host memory abort path, so let's use the low-level __host_stage2_idmap() function directly instead of the higher-level wrapper that attempts page recycling when running out of memory. Bug: 264070847 Change-Id: I2db34777386931bfb3f93ea3b3e51e1e2a10ea79 Signed-off-by: Quentin Perret --- arch/arm64/kvm/hyp/nvhe/mem_protect.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c b/arch/arm64/kvm/hyp/nvhe/mem_protect.c index 9c99d2c53bf2..099b25bfcbbe 100644 --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c @@ -799,7 +799,11 @@ static int host_stage2_idmap(struct kvm_vcpu_fault_info *fault, u64 addr) if (ret) return ret; - return host_stage2_idmap_locked(range.start, range.end - range.start, prot, false); + /* + * We're guaranteed not to require memory allocation by construction, + * no need to bother even trying to recycle pages. + */ + return __host_stage2_idmap(range.start, range.end, prot, false); } static void (*illegal_abt_notifier)(struct kvm_cpu_context *host_ctxt);