]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: arm64: Only drop references on empty tables in stage2_free_walker
authorOliver Upton <oupton@kernel.org>
Wed, 19 Nov 2025 22:11:50 +0000 (14:11 -0800)
committerOliver Upton <oupton@kernel.org>
Wed, 19 Nov 2025 22:11:50 +0000 (14:11 -0800)
commit156f70afcfecfc45be5fdc2e4adebc5ea70a93b0
tree98d34ba699f417b12b3a49b3cf894ca5ce43c1dc
parent85f329df293119d6ba1a26453d109556631081a4
KVM: arm64: Only drop references on empty tables in stage2_free_walker

A subsequent change to the way KVM frees stage-2s will invoke the free
walker on sub-ranges of the VM's IPA space, meaning there's potential
for only partially visiting a table's PTEs.

Split the leaf and table visitors and only drop references on a table
when the page count reaches 1, implying there are no valid PTEs that
need to be visited. Invalidate the table PTE to avoid traversing the
stale reference.

Link: https://msgid.link/20251113052452.975081-2-rananta@google.com
Signed-off-by: Oliver Upton <oupton@kernel.org>
arch/arm64/kvm/hyp/pgtable.c