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

Janosch Frank
2026-04-15T08:52:37Z

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));
}
--
2.51.0