Re: [PATCH v2 1/2] KVM: arm64: Resume stage-2 teardown where the walk stopped
From: Suzuki K Poulose
Date: Thu Nov 05 2026 - 06:12:46 EST
On 04/11/2026 12:44, Fuad Tabba wrote:
Since commit 4ddfab5436b6 ("KVM: arm64: Reschedule as needed when
destroying the stage-2 page-tables"), kvm_stage2_destroy() walks the
IPA space one block-sized chunk at a time. The walker steps over an
invalid entry in one go, but the next walk starts at the following
chunk, so an invalid entry larger than a chunk is visited once for every
chunk it covers. Destroying a VM with a 52-bit IPA then takes 2^27 walks
with 16K pages (2^22 with 4K), however little it maps.
Have kvm_pgtable_stage2_destroy_range() return the address its walk
reached, which kvm_pgtable_walk() doesn't expose, and resume from there.
pkvm_pgtable_stage2_destroy_range() returns the end of its range, and
EL2's kvm_pgtable_stage2_destroy() ignores the value.
Suggested-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
Suggested-by: Oliver Upton <oupton@xxxxxxxxxx>
Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
Thanks Fuad for this, looks good to me with Oliver's suggestion.
Cheers
Suzuki