[PATCH v5 2/5] KVM: arm64: Add pre_fault_memory implementation
Alexandru Elisei
alexandru.elisei at arm.com
Tue Aug 11 09:03:43 PDT 2026
Hi Aneesh,
On Mon, Aug 03, 2026 at 11:36:33AM +0530, Aneesh Kumar K.V wrote:
> Alexandru Elisei <alexandru.elisei at arm.com> writes:
>
> > Hi Jack,
> >
> > On Fri, Jun 12, 2026 at 05:23:50PM +0100, Jack Thomson wrote:
> >> From: Jack Thomson <jackabt at amazon.com>
>
> ....
>
> >> + if (kvm_is_error_hva(hva)) {
> >> + ret = -EFAULT;
> >> + goto out;
> >> + }
> >> +
> >> + s2fd.hva = hva;
> >> + ret = user_mem_abort(&s2fd);
> >
> > If is_protected_kvm_enabled(), this function doesn't check if the mapping
> > already exists. user_mem_abort() will call **p**kvm_pgtable_stage2_map()
> > (emphasis is mine) to create the mapping, and pkvm_pgtable_stage2_map() will
> > return -EAGAIN, and keep returning -EAGAIN until the mapping is destroyed, which
> > might be some time away.
> >
> > Same thing happens **without** pKVM, kvm_pgtable_stage2_map() will return
> > -EAGAIN if the mapping exists. But that's not such a big issue, when the
> > user calls KVM_PRE_FAULT_MEMORY on the remaining range
> > kvm_pgtable_get_leaf() will detect the existing mapping. Which you have
> > already taken into consideration judging by the comment, so all good here.
> >
>
> But both gmem_abort() and user_mem_abort() handle -EAGAIN internally, don't they?
I think you're right, please ignore my comment about an existing mapping with
is_protected_kvm_enabled().
Thanks,
Alex
More information about the linux-arm-kernel
mailing list