Skip to content

Commit d12a91e

Browse files
frankjaahuth
authored andcommitted
target/s390x/arch_dump: Add arch cleanup function for PV dumps
PV dumps block vcpu runs until dump end is reached. If there's an error between PV dump init and PV dump end the vm will never be able to run again. One example of such an error is insufficient disk space for the dump file. Let's add a cleanup function that tries to do a dump end. The dump completion data is discarded but there's no point in writing it to a file anyway if there's a possibility that other PV dump data is missing. Signed-off-by: Janosch Frank <frankja@linux.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20231109120443.185979-4-frankja@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
1 parent e72629e commit d12a91e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

target/s390x/arch_dump.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,22 @@ static int arch_sections_write(DumpState *s, uint8_t *buff)
433433
return 0;
434434
}
435435

436+
static void arch_cleanup(DumpState *s)
437+
{
438+
g_autofree uint8_t *buff = NULL;
439+
int rc;
440+
441+
if (!pv_dump_initialized) {
442+
return;
443+
}
444+
445+
buff = g_malloc(kvm_s390_pv_dmp_get_size_completion_data());
446+
rc = kvm_s390_dump_completion_data(buff);
447+
if (!rc) {
448+
pv_dump_initialized = false;
449+
}
450+
}
451+
436452
int cpu_get_dump_info(ArchDumpInfo *info,
437453
const struct GuestPhysBlockList *guest_phys_blocks)
438454
{
@@ -448,6 +464,7 @@ int cpu_get_dump_info(ArchDumpInfo *info,
448464
info->arch_sections_add_fn = *arch_sections_add;
449465
info->arch_sections_write_hdr_fn = *arch_sections_write_hdr;
450466
info->arch_sections_write_fn = *arch_sections_write;
467+
info->arch_cleanup_fn = *arch_cleanup;
451468
}
452469
return 0;
453470
}

0 commit comments

Comments
 (0)