|
|
9ae3a8 |
From b67ef65a1f5d8ceb02ca11c0af92d2c06fd006cb Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Date: Wed, 13 Dec 2017 13:38:57 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 26/41] dump-guest-memory: introduce dump_process() helper
|
|
|
9ae3a8 |
function.
|
|
|
9ae3a8 |
MIME-Version: 1.0
|
|
|
9ae3a8 |
Content-Type: text/plain; charset=UTF-8
|
|
|
9ae3a8 |
Content-Transfer-Encoding: 8bit
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Message-id: <20171213133912.26176-27-marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 78375
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.5 qemu-kvm PATCH v3 26/41] dump-guest-memory: introduce dump_process() helper function.
|
|
|
9ae3a8 |
Bugzilla: 1411490
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Peter Xu <peterx@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
No functional change. Cleanup only.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Peter Xu <peterx@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Message-Id: <1455772616-8668-6-git-send-email-peterx@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
(cherry picked from commit ca1fc8c97e9f26690b1ddbbbced5bafb3d65f6b5)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RHEL: minor conflict due to "detach" mode not being backported.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
dump.c | 35 +++++++++++++++++++++++------------
|
|
|
9ae3a8 |
include/sysemu/dump.h | 3 +++
|
|
|
9ae3a8 |
2 files changed, 26 insertions(+), 12 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/dump.c b/dump.c
|
|
|
9ae3a8 |
index 639d52a..4bce6cf 100644
|
|
|
9ae3a8 |
--- a/dump.c
|
|
|
9ae3a8 |
+++ b/dump.c
|
|
|
9ae3a8 |
@@ -1470,6 +1470,9 @@ static void dump_init(DumpState *s, int fd, bool has_format,
|
|
|
9ae3a8 |
Error *err = NULL;
|
|
|
9ae3a8 |
int ret;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ s->has_format = has_format;
|
|
|
9ae3a8 |
+ s->format = format;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
/* kdump-compressed is conflict with paging and filter */
|
|
|
9ae3a8 |
if (has_format && format != DUMP_GUEST_MEMORY_FORMAT_ELF) {
|
|
|
9ae3a8 |
assert(!paging && !has_filter);
|
|
|
9ae3a8 |
@@ -1628,8 +1631,25 @@ cleanup:
|
|
|
9ae3a8 |
dump_cleanup(s);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
|
|
|
9ae3a8 |
- int64_t begin, bool has_length,
|
|
|
9ae3a8 |
+/* this operation might be time consuming. */
|
|
|
9ae3a8 |
+static void dump_process(DumpState *s, Error **errp)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ Error *local_err = NULL;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (s->has_format && s->format != DUMP_GUEST_MEMORY_FORMAT_ELF) {
|
|
|
9ae3a8 |
+ create_kdump_vmcore(s, &local_err);
|
|
|
9ae3a8 |
+ } else {
|
|
|
9ae3a8 |
+ create_vmcore(s, &local_err);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ s->status = (local_err ? DUMP_STATUS_FAILED : DUMP_STATUS_COMPLETED);
|
|
|
9ae3a8 |
+ error_propagate(errp, local_err);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ dump_cleanup(s);
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+void qmp_dump_guest_memory(bool paging, const char *file,
|
|
|
9ae3a8 |
+ bool has_begin, int64_t begin, bool has_length,
|
|
|
9ae3a8 |
int64_t length, bool has_format,
|
|
|
9ae3a8 |
DumpGuestMemoryFormat format, Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
@@ -1712,16 +1732,7 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
|
|
|
9ae3a8 |
return;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- if (has_format && format != DUMP_GUEST_MEMORY_FORMAT_ELF) {
|
|
|
9ae3a8 |
- create_kdump_vmcore(s, &local_err);
|
|
|
9ae3a8 |
- } else {
|
|
|
9ae3a8 |
- create_vmcore(s, &local_err);
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- s->status = (local_err ? DUMP_STATUS_FAILED : DUMP_STATUS_COMPLETED);
|
|
|
9ae3a8 |
- error_propagate(errp, local_err);
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- dump_cleanup(s);
|
|
|
9ae3a8 |
+ dump_process(s, errp);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
DumpGuestMemoryCapability *qmp_query_dump_guest_memory_capability(Error **errp)
|
|
|
9ae3a8 |
diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h
|
|
|
9ae3a8 |
index 21fc02d..1da3ddb 100644
|
|
|
9ae3a8 |
--- a/include/sysemu/dump.h
|
|
|
9ae3a8 |
+++ b/include/sysemu/dump.h
|
|
|
9ae3a8 |
@@ -178,6 +178,9 @@ typedef struct DumpState {
|
|
|
9ae3a8 |
size_t num_dumpable; /* number of page that can be dumped */
|
|
|
9ae3a8 |
uint32_t flag_compress; /* indicate the compression format */
|
|
|
9ae3a8 |
DumpStatus status; /* current dump status */
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ bool has_format; /* whether format is provided */
|
|
|
9ae3a8 |
+ DumpGuestMemoryFormat format; /* valid only if has_format == true */
|
|
|
9ae3a8 |
} DumpState;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
uint16_t cpu_to_dump16(DumpState *s, uint16_t val);
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|