[PATCH v4 2/2] KVM: arm64: nv: Delay freeing of shadow S2 structures until VM destruction

Wei-Lin Chang weilin.chang at arm.com
Fri Sep 11 11:59:16 PDT 2026


On Fri, Sep 11, 2026 at 05:22:03PM +0100, Marc Zyngier wrote:
> We free the shadow S2 structures from kvm_arch_flush_shadow_all(), which
> is a Bad Idea(tm). Freeing the page tables is fair game (this is what
> this callback is for), but freeing the container that could still be
> referenced by another part of the system is not great.
> 
> Instead, grow separate destructors that gets called when we tear the VM
> down for good. From there, we can nuke both the individual MMUs as well
> as the global array that points to them, safe in the knowledge that the
> vcpus themselves have been destroyed already.
> 
> Fixes: 4f128f8e1aaac ("KVM: arm64: nv: Support multiple nested Stage-2 mmu structures")
> Reviewed-by: Lorenzo Stoakes (ARM) <ljs at kernel.org>
> Signed-off-by: Marc Zyngier <maz at kernel.org>
> Cc: stable at vger.kernel.org

Reviewed-by: Wei-Lin Chang <weilin.chang at arm.com>

> ---

[...]




More information about the linux-arm-kernel mailing list