dump: Add arch cleanup function
authorJanosch Frank <frankja@linux.ibm.com>
Thu, 9 Nov 2023 12:04:42 +0000 (12:04 +0000)
committerThomas Huth <thuth@redhat.com>
Tue, 14 Nov 2023 09:42:32 +0000 (10:42 +0100)
Some architectures (s390x) need to cleanup after a failed dump to be
able to continue to run the vm. Add a cleanup function pointer and
call it if it's set.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20231109120443.185979-3-frankja@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
dump/dump.c
include/sysemu/dump-arch.h

index ad5294e8536f7d82b2ac9c34b59282185bb817e5..481905076493c7d723e01f84a08e76ea0e5550e3 100644 (file)
@@ -96,6 +96,10 @@ uint64_t cpu_to_dump64(DumpState *s, uint64_t val)
 
 static int dump_cleanup(DumpState *s)
 {
+    if (s->dump_info.arch_cleanup_fn) {
+        s->dump_info.arch_cleanup_fn(s);
+    }
+
     guest_phys_blocks_free(&s->guest_phys_blocks);
     memory_mapping_list_free(&s->list);
     close(s->fd);
index 59bbc9be38c9af0f6181743e2d5ceca97c345693..743916e46ca137f301d034c295baed8bc8f20d68 100644 (file)
@@ -24,6 +24,7 @@ typedef struct ArchDumpInfo {
     void (*arch_sections_add_fn)(DumpState *s);
     uint64_t (*arch_sections_write_hdr_fn)(DumpState *s, uint8_t *buff);
     int (*arch_sections_write_fn)(DumpState *s, uint8_t *buff);
+    void (*arch_cleanup_fn)(DumpState *s);
 } ArchDumpInfo;
 
 struct GuestPhysBlockList; /* memory_mapping.h */