@@ -8052,7 +8052,7 @@ See KVM_EXIT_MEMORY_FAULT for more information.
7.35 KVM_CAP_EXIT_ON_MISSING
----------------------------
-:Architectures: x86
+:Architectures: x86, arm64
:Returns: Informational only, -EINVAL on direct KVM_ENABLE_CAP.
The presence of this capability indicates that userspace may set the
@@ -39,6 +39,7 @@ menuconfig KVM
select SCHED_INFO
select GUEST_PERF_EVENTS if PERF_EVENTS
select XARRAY_MULTI
+ select HAVE_KVM_EXIT_ON_MISSING
help
Support hosting virtualized guest machines.
@@ -1487,7 +1487,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
mmap_read_unlock(current->mm);
pfn = __gfn_to_pfn_memslot(memslot, gfn, false, false, NULL,
- write_fault, &writable, false, NULL);
+ write_fault, &writable, true, NULL);
if (pfn == KVM_PFN_ERR_HWPOISON) {
kvm_send_hwpoison_signal(hva, vma_shift);
return 0;
Prevent the stage-2 fault handler from faulting in pages when KVM_MEM_EXIT_ON_MISSING is set by allowing its __gfn_to_pfn_memslot() call to check the memslot flag. This effects the delivery of stage-2 faults as vCPU exits (see KVM_CAP_MEMORY_FAULT_INFO), which userspace can attempt to resolve without terminating the guest. Delivering stage-2 faults to userspace in this way sidesteps the significant scalabiliy issues associated with using userfaultfd for the same purpose. Signed-off-by: Anish Moorthy <amoorthy@google.com> --- Documentation/virt/kvm/api.rst | 2 +- arch/arm64/kvm/Kconfig | 1 + arch/arm64/kvm/mmu.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-)