* [PULL 1/3] target/s390x/dump: Remove unneeded dump info function pointer init
2023-11-14 11:43 [PULL 0/3] Fix s390x PV dumps in case of errors Thomas Huth
@ 2023-11-14 11:43 ` Thomas Huth
2023-11-14 11:43 ` [PULL 2/3] dump: Add arch cleanup function Thomas Huth
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2023-11-14 11:43 UTC (permalink / raw)
To: qemu-devel; +Cc: Stefan Hajnoczi, Janosch Frank, Marc-André Lureau
From: Janosch Frank <frankja@linux.ibm.com>
dump_state_prepare() now sets the function pointers to NULL so we only
need to touch them if we're going to use them.
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20231109120443.185979-2-frankja@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
target/s390x/arch_dump.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/target/s390x/arch_dump.c b/target/s390x/arch_dump.c
index 51a2116515..bdb0bfa0e7 100644
--- a/target/s390x/arch_dump.c
+++ b/target/s390x/arch_dump.c
@@ -448,10 +448,6 @@ int cpu_get_dump_info(ArchDumpInfo *info,
info->arch_sections_add_fn = *arch_sections_add;
info->arch_sections_write_hdr_fn = *arch_sections_write_hdr;
info->arch_sections_write_fn = *arch_sections_write;
- } else {
- info->arch_sections_add_fn = NULL;
- info->arch_sections_write_hdr_fn = NULL;
- info->arch_sections_write_fn = NULL;
}
return 0;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PULL 2/3] dump: Add arch cleanup function
2023-11-14 11:43 [PULL 0/3] Fix s390x PV dumps in case of errors Thomas Huth
2023-11-14 11:43 ` [PULL 1/3] target/s390x/dump: Remove unneeded dump info function pointer init Thomas Huth
@ 2023-11-14 11:43 ` Thomas Huth
2023-11-14 11:43 ` [PULL 3/3] target/s390x/arch_dump: Add arch cleanup function for PV dumps Thomas Huth
2023-11-14 17:32 ` [PULL 0/3] Fix s390x PV dumps in case of errors Stefan Hajnoczi
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2023-11-14 11:43 UTC (permalink / raw)
To: qemu-devel; +Cc: Stefan Hajnoczi, Janosch Frank, Marc-André Lureau
From: Janosch Frank <frankja@linux.ibm.com>
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>
---
include/sysemu/dump-arch.h | 1 +
dump/dump.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/include/sysemu/dump-arch.h b/include/sysemu/dump-arch.h
index 59bbc9be38..743916e46c 100644
--- a/include/sysemu/dump-arch.h
+++ b/include/sysemu/dump-arch.h
@@ -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 */
diff --git a/dump/dump.c b/dump/dump.c
index ad5294e853..4819050764 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -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);
--
2.41.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PULL 3/3] target/s390x/arch_dump: Add arch cleanup function for PV dumps
2023-11-14 11:43 [PULL 0/3] Fix s390x PV dumps in case of errors Thomas Huth
2023-11-14 11:43 ` [PULL 1/3] target/s390x/dump: Remove unneeded dump info function pointer init Thomas Huth
2023-11-14 11:43 ` [PULL 2/3] dump: Add arch cleanup function Thomas Huth
@ 2023-11-14 11:43 ` Thomas Huth
2023-11-14 17:32 ` [PULL 0/3] Fix s390x PV dumps in case of errors Stefan Hajnoczi
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2023-11-14 11:43 UTC (permalink / raw)
To: qemu-devel
Cc: Stefan Hajnoczi, Janosch Frank, Claudio Imbrenda,
Marc-André Lureau
From: Janosch Frank <frankja@linux.ibm.com>
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>
---
target/s390x/arch_dump.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/target/s390x/arch_dump.c b/target/s390x/arch_dump.c
index bdb0bfa0e7..7e8a1b4fc0 100644
--- a/target/s390x/arch_dump.c
+++ b/target/s390x/arch_dump.c
@@ -433,6 +433,22 @@ static int arch_sections_write(DumpState *s, uint8_t *buff)
return 0;
}
+static void arch_cleanup(DumpState *s)
+{
+ g_autofree uint8_t *buff = NULL;
+ int rc;
+
+ if (!pv_dump_initialized) {
+ return;
+ }
+
+ buff = g_malloc(kvm_s390_pv_dmp_get_size_completion_data());
+ rc = kvm_s390_dump_completion_data(buff);
+ if (!rc) {
+ pv_dump_initialized = false;
+ }
+}
+
int cpu_get_dump_info(ArchDumpInfo *info,
const struct GuestPhysBlockList *guest_phys_blocks)
{
@@ -448,6 +464,7 @@ int cpu_get_dump_info(ArchDumpInfo *info,
info->arch_sections_add_fn = *arch_sections_add;
info->arch_sections_write_hdr_fn = *arch_sections_write_hdr;
info->arch_sections_write_fn = *arch_sections_write;
+ info->arch_cleanup_fn = *arch_cleanup;
}
return 0;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PULL 0/3] Fix s390x PV dumps in case of errors
2023-11-14 11:43 [PULL 0/3] Fix s390x PV dumps in case of errors Thomas Huth
` (2 preceding siblings ...)
2023-11-14 11:43 ` [PULL 3/3] target/s390x/arch_dump: Add arch cleanup function for PV dumps Thomas Huth
@ 2023-11-14 17:32 ` Stefan Hajnoczi
3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2023-11-14 17:32 UTC (permalink / raw)
To: Thomas Huth; +Cc: qemu-devel, Stefan Hajnoczi
[-- Attachment #1: Type: text/plain, Size: 115 bytes --]
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/8.2 for any user-visible changes.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread