Skip to content

Commit

Permalink
Merge tag 'pull-request-2023-11-14' of https://gitlab.com/thuth/qemu
Browse files Browse the repository at this point in the history
…into staging

* Fix s390x PV dumps in case of errors

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmVTXR4RHHRodXRoQHJl
# ZGhhdC5jb20ACgkQLtnXdP5wLbUzBg//ZDrzcInE59jo6zuEJiDYdqkauxiJWqdm
# PF3AaemZdww/SZ94960BLCPLm/53L4qeNHl9F4HMoCCqfqp6gUVouc0Rh5kd8/Bn
# 0+ND4Ni20LgKrr/10M8frVreujYhWEtILWA3Ef3HkMWGt45RB8mMwpYwmIZh6DHv
# B45xZaiOWzXNtroGSEBO52MuWzAlbBi68iVCS8xJ/q5xOe0s6julS4EwGo8P6R0c
# VZKlGM8KVndPPiRmG4NSyqpg91fp2p0Zo4Ol6GMSMsljvLB4aSIu0lDMR2FjreIv
# Fjmz78CZbNmgh/7edH1+vj+P083kEGwD7j1WHq4gbFONFdP8Gp0NQjhj/Zl4HsQh
# aCwVMuSdQmg7KEvn1wXc29kL9rBsG/5t5mSPkAzvM/kDahchtltpRxFYgcTGLhNs
# lT4cBjXSmyL2bCc1lX4sEw3/0RZE2GTRtuvP3caJWMZAAxYuE18LstWalPV5ttqe
# p7Xg/XRjOYlM2FGIMI9L5KR4mNKzWduvxnU/3o7qHUOEtWe9mICzCwC8UilLYbjd
# sGRJ5KRYN2nIzqTm0K50rrXPop9zVUHRSl37/9bV9+z6mFAh6Tg4+gIdQPayTo0S
# omRpMUMxmKkKSk1lTFWRr59sxTI+S5ANbRLeApxJsxXGCvoOzAn4nE7fxEpmTR2e
# ocddl9Wg4+w=
# =sFZX
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 14 Nov 2023 06:42:22 EST
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* tag 'pull-request-2023-11-14' of https://gitlab.com/thuth/qemu:
  target/s390x/arch_dump: Add arch cleanup function for PV dumps
  dump: Add arch cleanup function
  target/s390x/dump: Remove unneeded dump info function pointer init

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
  • Loading branch information
stefanhaRH committed Nov 14, 2023
2 parents 52105c6 + d12a91e commit 6d44474
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
4 changes: 4 additions & 0 deletions dump/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions include/sysemu/dump-arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
21 changes: 17 additions & 4 deletions target/s390x/arch_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -448,10 +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;
} else {
info->arch_sections_add_fn = NULL;
info->arch_sections_write_hdr_fn = NULL;
info->arch_sections_write_fn = NULL;
info->arch_cleanup_fn = *arch_cleanup;
}
return 0;
}
Expand Down

0 comments on commit 6d44474

Please sign in to comment.