Re: [PATCH v2 2/2] KVM: arm64: Resume a pKVM stage-2 teardown at the next mapping

From: Fuad Tabba

Date: Thu Nov 05 2026 - 06:13:25 EST


On Thu, 5 Nov 2026 at 09:45, Vincent Donnefort <vdonnefort@xxxxxxxxxx> wrote:
[...]
> > - return addr + size;
> > + /* Mappings left by a failed release are still in the tree, so look past the range. */
>
> Hum, not sure I understand that comment. Which release are we talking about? The
> _reclaim or _unshare? If yes, we don't propagate the error and WARN if any of
> them fails. So we don't expect any failure here and I'd say there's nothing
> special to do?
>
> Additionally, in any case, iter_first(addr + size) seems like the right thing to
> do and is self-explanatory.

Yes, a leftover mapping would be returned again from addr. But since
that already WARNs, I'll drop the comment.

> > + mapping = pkvm_mapping_iter_first(&pgt->pkvm_mappings, addr + size, U64_MAX);
> > +
> > + return mapping ? gfn_to_gpa(mapping->gfn) : U64_MAX;
> > }
> >
> > void pkvm_pgtable_stage2_destroy_pgd(struct kvm_pgtable *pgt)
> > --
> > 2.47.3
> >
>
> Reviewed-by: Vincent Donnefort <vdonnefort@xxxxxxxxxx>

Thanks!
/fuad