diff options
| author | Lorenzo Stoakes (ARM) <ljs@kernel.org> | 2026-09-23 16:15:53 +0100 |
|---|---|---|
| committer | Marc Zyngier <maz@kernel.org> | 2026-09-24 23:28:13 +0100 |
| commit | 34cfa9b3af17d0554ffd6c655fc1097854b49487 (patch) | |
| tree | 2624005bc92c834a2678a810575849d363581b3e /tools/perf/scripts/python/bin/stackcollapse-report | |
| parent | ee26443f3dd70a961ad5e9384d5f41a8675213d1 (diff) | |
KVM: arm64: Implement KVM_PRE_FAULT_MEMORY
Implement KVM stage 2 page table pre-faulting for the arm64 architecture,
with the core of the implementation in kvm_arch_vcpu_pre_fault_memory().
Pre-fault by first trying a page table walk under the MMU read lock then,
if it fails, injecting a synthetic data abort at the page table level
at which the page table walk failed.
This is necessarily racey as reclaim might happen at any time. Successfully
pre-faulting can therefore only guarantee that each GPA was observed to be
mapped at least once.
Protected KVM (pKVM) is not supported at all because pKVM creates VMs and
vCPUs when first run, meaning any attempt to pre-fault prior to this cannot
succeed.
Additionally, in pKVM mode, the stage 2 page tables are owned by the
hypervisor rather than the host - the host can neither walk them nor
populate them directly, so it's not clear that the pre-fault mechanism
correctly maps onto pKVM.
Reject both pKVM hosts and uninitialised vCPUs, which are not in a safe
state to be loaded, from the kvm_arch_pre_fault_allowed() hook so they are
refused before the vCPU is loaded.
A retry mechanic is implemented when user_mem_abort() or gmem_abort() fail
to map memory due to a benign failure where a hardware abort would not
result in an error.
An invalid memslot (i.e. a memslot with the KVM_MEMSLOT_INVALID flag set)
results in the operation returning -EAGAIN without a retry mechanic,
because an invalid memslot means the pre-fault operation raced with memslot
reclaim, and since the SRCU lock is held, progress cannot be made, and the
user must retry.
This work is based with gratitude on Jack Thomson's original series, its
previous revisions and the feedback they received.
Link: https://patch.msgid.link/20260612162354.73378-1-jackabt.amazon@gmail.com/
Reviewed-by: Oliver Upton <oupton@kernel.org>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Tested-by: Fuad Tabba <fuad.tabba@linux.dev>
Link: https://patch.msgid.link/20260923-kvm-arm-prefault-v4-10-d4b0b4dfa8c3@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-report')
0 files changed, 0 insertions, 0 deletions
