Re: [kvm-unit-tests 3/5] lib: s390x: sie: Free guest memory on destroy

Nico Boehr
2026-04-15T14:21:12Z

On Wed Apr 15, 2026 at 10:45 AM CEST, Janosch Frank wrote:
> We never freed the memory that the sie library allocates as the guest
> ram on destruction of the VM. Most tests reuse the VM or just leak the
> memory since the standard allocation is one megabyte and tests only
> use single digit numbers of VMs.
>
> It's time to add automatic freeing to the sie library when a VM is
> destroyed.
>
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
> lib/s390x/sie.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/lib/s390x/sie.c b/lib/s390x/sie.c
> index a49c45c7..758ead77 100644
> --- a/lib/s390x/sie.c
> +++ b/lib/s390x/sie.c
> @@ -192,4 +192,5 @@ void sie_guest_destroy(struct vm *vm)
> free_page(vm->sblk);
> if (vm->sblk->ecb2 & ECB2_ESCA)
> free_page(vm->sca);
> + free_pages((void *)virt_to_pte_phys(get_page_root(), vm->guest_mem));
> }

Is there a particular reason why we have a two-step process of calling
sie_guest_alloc() for memory allocation
and then
sie_guest_create() for initializing the sie_block etc

but
sie_guest_destroy()
cleans up both?