From: Aneesh Kumar K.V <aneesh.kumar@kernel.org>
To: Alexandru Elisei <alexandru.elisei@arm.com>,
Jack Thomson <jackabt.amazon@gmail.com>
Cc: maz@kernel.org, oupton@kernel.org, pbonzini@redhat.com,
joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com,
yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org,
shuah@kernel.org, corbet@lwn.net, vladimir.murzin@arm.com,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org,
isaku.yamahata@intel.com, Jack Thomson <jackabt@amazon.com>
Subject: Re: [PATCH v5 2/5] KVM: arm64: Add pre_fault_memory implementation
Date: Mon, 03 Aug 2026 11:36:33 +0530 [thread overview]
Message-ID: <yq5acxvz4u1i.fsf@kernel.org> (raw)
In-Reply-To: <alEXtW7w-rqlNG09@raptor>
Alexandru Elisei <alexandru.elisei@arm.com> writes:
> Hi Jack,
>
> On Fri, Jun 12, 2026 at 05:23:50PM +0100, Jack Thomson wrote:
>> From: Jack Thomson <jackabt@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?
For gmem_abort(), we have:
1692: return ret != -EAGAIN ? ret : 0;
For user_mem_abort(), the call path is:
user_mem_abort()
-> kvm_s2_fault_map()
-> KVM_PGT_FN(kvm_pgtable_stage2_map)(pgt, ...)
and kvm_s2_fault_map() does:
2111: if (ret != -EAGAIN)
return ret;
return 0;
-aneesh
next prev parent reply other threads:[~2026-08-03 6:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 16:23 [PATCH v5 0/5] KVM: arm64: Add KVM_PRE_FAULT_MEMORY support Jack Thomson
2026-06-12 16:23 ` [PATCH v5 1/5] KVM: arm64: Pass walk flags to kvm_pgtable_get_leaf() Jack Thomson
2026-06-12 16:23 ` [PATCH v5 2/5] KVM: arm64: Add pre_fault_memory implementation Jack Thomson
2026-07-08 15:25 ` Alexandru Elisei
2026-07-10 16:00 ` Alexandru Elisei
2026-07-10 16:03 ` Alexandru Elisei
2026-08-03 6:06 ` Aneesh Kumar K.V [this message]
2026-07-27 11:11 ` Vincent Donnefort
2026-06-12 16:23 ` [PATCH v5 3/5] KVM: selftests: Enable pre_fault_memory_test for arm64 Jack Thomson
2026-06-12 16:23 ` [PATCH v5 4/5] KVM: selftests: Add option for different backing in pre-fault tests Jack Thomson
2026-06-12 16:23 ` [PATCH v5 5/5] KVM: selftests: Add nested pre-fault test for arm64 Jack Thomson
2026-06-12 16:35 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yq5acxvz4u1i.fsf@kernel.org \
--to=aneesh.kumar@kernel.org \
--cc=alexandru.elisei@arm.com \
--cc=catalin.marinas@arm.com \
--cc=corbet@lwn.net \
--cc=isaku.yamahata@intel.com \
--cc=jackabt.amazon@gmail.com \
--cc=jackabt@amazon.com \
--cc=joey.gouly@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=pbonzini@redhat.com \
--cc=seiden@linux.ibm.com \
--cc=shuah@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=vladimir.murzin@arm.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox