|
|
9ae3a8 |
From 86459b009f0402a2cdf3ef6a944684b62ac2ea0a Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
Date: Fri, 7 Nov 2014 17:17:58 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 11/41] dump: add API to write dump header
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Message-id: <1415380693-16593-12-git-send-email-lersek@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 62197
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.1 qemu-kvm PATCH 11/26] dump: add API to write dump header
|
|
|
9ae3a8 |
Bugzilla: 1157798
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: dgibson <dgibson@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: qiaonuohan <qiaonuohan@cn.fujitsu.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
the functions are used to write header of kdump-compressed format to vmcore.
|
|
|
9ae3a8 |
Header of kdump-compressed format includes:
|
|
|
9ae3a8 |
1. common header: DiskDumpHeader32 / DiskDumpHeader64
|
|
|
9ae3a8 |
2. sub header: KdumpSubHeader32 / KdumpSubHeader64
|
|
|
9ae3a8 |
3. extra information: only elf notes here
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
|
|
|
9ae3a8 |
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 298f116827405f37dde10a2a6cbc75d20f9ba99c)
|
|
|
9ae3a8 |
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
dump.c | 223 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
9ae3a8 |
include/sysemu/dump.h | 96 ++++++++++++++++++++++
|
|
|
9ae3a8 |
2 files changed, 319 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/dump.c b/dump.c
|
|
|
9ae3a8 |
index 88e8cc0..4d135fd 100644
|
|
|
9ae3a8 |
--- a/dump.c
|
|
|
9ae3a8 |
+++ b/dump.c
|
|
|
9ae3a8 |
@@ -784,6 +784,229 @@ static int buf_write_note(const void *buf, size_t size, void *opaque)
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+/* write common header, sub header and elf note to vmcore */
|
|
|
9ae3a8 |
+static int create_header32(DumpState *s)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ int ret = 0;
|
|
|
9ae3a8 |
+ DiskDumpHeader32 *dh = NULL;
|
|
|
9ae3a8 |
+ KdumpSubHeader32 *kh = NULL;
|
|
|
9ae3a8 |
+ size_t size;
|
|
|
9ae3a8 |
+ int endian = s->dump_info.d_endian;
|
|
|
9ae3a8 |
+ uint32_t block_size;
|
|
|
9ae3a8 |
+ uint32_t sub_hdr_size;
|
|
|
9ae3a8 |
+ uint32_t bitmap_blocks;
|
|
|
9ae3a8 |
+ uint32_t status = 0;
|
|
|
9ae3a8 |
+ uint64_t offset_note;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* write common header, the version of kdump-compressed format is 6th */
|
|
|
9ae3a8 |
+ size = sizeof(DiskDumpHeader32);
|
|
|
9ae3a8 |
+ dh = g_malloc0(size);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE));
|
|
|
9ae3a8 |
+ dh->header_version = cpu_convert_to_target32(6, endian);
|
|
|
9ae3a8 |
+ block_size = s->page_size;
|
|
|
9ae3a8 |
+ dh->block_size = cpu_convert_to_target32(block_size, endian);
|
|
|
9ae3a8 |
+ sub_hdr_size = sizeof(struct KdumpSubHeader32) + s->note_size;
|
|
|
9ae3a8 |
+ sub_hdr_size = DIV_ROUND_UP(sub_hdr_size, block_size);
|
|
|
9ae3a8 |
+ dh->sub_hdr_size = cpu_convert_to_target32(sub_hdr_size, endian);
|
|
|
9ae3a8 |
+ /* dh->max_mapnr may be truncated, full 64bit is in kh.max_mapnr_64 */
|
|
|
9ae3a8 |
+ dh->max_mapnr = cpu_convert_to_target32(MIN(s->max_mapnr, UINT_MAX),
|
|
|
9ae3a8 |
+ endian);
|
|
|
9ae3a8 |
+ dh->nr_cpus = cpu_convert_to_target32(s->nr_cpus, endian);
|
|
|
9ae3a8 |
+ bitmap_blocks = DIV_ROUND_UP(s->len_dump_bitmap, block_size) * 2;
|
|
|
9ae3a8 |
+ dh->bitmap_blocks = cpu_convert_to_target32(bitmap_blocks, endian);
|
|
|
9ae3a8 |
+ memcpy(&(dh->utsname.machine), "i686", 4);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (s->flag_compress & DUMP_DH_COMPRESSED_ZLIB) {
|
|
|
9ae3a8 |
+ status |= DUMP_DH_COMPRESSED_ZLIB;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+#ifdef CONFIG_LZO
|
|
|
9ae3a8 |
+ if (s->flag_compress & DUMP_DH_COMPRESSED_LZO) {
|
|
|
9ae3a8 |
+ status |= DUMP_DH_COMPRESSED_LZO;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+#endif
|
|
|
9ae3a8 |
+#ifdef CONFIG_SNAPPY
|
|
|
9ae3a8 |
+ if (s->flag_compress & DUMP_DH_COMPRESSED_SNAPPY) {
|
|
|
9ae3a8 |
+ status |= DUMP_DH_COMPRESSED_SNAPPY;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+#endif
|
|
|
9ae3a8 |
+ dh->status = cpu_convert_to_target32(status, endian);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (write_buffer(s->fd, 0, dh, size) < 0) {
|
|
|
9ae3a8 |
+ dump_error(s, "dump: failed to write disk dump header.\n");
|
|
|
9ae3a8 |
+ ret = -1;
|
|
|
9ae3a8 |
+ goto out;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* write sub header */
|
|
|
9ae3a8 |
+ size = sizeof(KdumpSubHeader32);
|
|
|
9ae3a8 |
+ kh = g_malloc0(size);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* 64bit max_mapnr_64 */
|
|
|
9ae3a8 |
+ kh->max_mapnr_64 = cpu_convert_to_target64(s->max_mapnr, endian);
|
|
|
9ae3a8 |
+ kh->phys_base = cpu_convert_to_target32(PHYS_BASE, endian);
|
|
|
9ae3a8 |
+ kh->dump_level = cpu_convert_to_target32(DUMP_LEVEL, endian);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ offset_note = DISKDUMP_HEADER_BLOCKS * block_size + size;
|
|
|
9ae3a8 |
+ kh->offset_note = cpu_convert_to_target64(offset_note, endian);
|
|
|
9ae3a8 |
+ kh->note_size = cpu_convert_to_target32(s->note_size, endian);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (write_buffer(s->fd, DISKDUMP_HEADER_BLOCKS *
|
|
|
9ae3a8 |
+ block_size, kh, size) < 0) {
|
|
|
9ae3a8 |
+ dump_error(s, "dump: failed to write kdump sub header.\n");
|
|
|
9ae3a8 |
+ ret = -1;
|
|
|
9ae3a8 |
+ goto out;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* write note */
|
|
|
9ae3a8 |
+ s->note_buf = g_malloc0(s->note_size);
|
|
|
9ae3a8 |
+ s->note_buf_offset = 0;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* use s->note_buf to store notes temporarily */
|
|
|
9ae3a8 |
+ if (write_elf32_notes(buf_write_note, s) < 0) {
|
|
|
9ae3a8 |
+ ret = -1;
|
|
|
9ae3a8 |
+ goto out;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (write_buffer(s->fd, offset_note, s->note_buf,
|
|
|
9ae3a8 |
+ s->note_size) < 0) {
|
|
|
9ae3a8 |
+ dump_error(s, "dump: failed to write notes");
|
|
|
9ae3a8 |
+ ret = -1;
|
|
|
9ae3a8 |
+ goto out;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* get offset of dump_bitmap */
|
|
|
9ae3a8 |
+ s->offset_dump_bitmap = (DISKDUMP_HEADER_BLOCKS + sub_hdr_size) *
|
|
|
9ae3a8 |
+ block_size;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* get offset of page */
|
|
|
9ae3a8 |
+ s->offset_page = (DISKDUMP_HEADER_BLOCKS + sub_hdr_size + bitmap_blocks) *
|
|
|
9ae3a8 |
+ block_size;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+out:
|
|
|
9ae3a8 |
+ g_free(dh);
|
|
|
9ae3a8 |
+ g_free(kh);
|
|
|
9ae3a8 |
+ g_free(s->note_buf);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ return ret;
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+/* write common header, sub header and elf note to vmcore */
|
|
|
9ae3a8 |
+static int create_header64(DumpState *s)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ int ret = 0;
|
|
|
9ae3a8 |
+ DiskDumpHeader64 *dh = NULL;
|
|
|
9ae3a8 |
+ KdumpSubHeader64 *kh = NULL;
|
|
|
9ae3a8 |
+ size_t size;
|
|
|
9ae3a8 |
+ int endian = s->dump_info.d_endian;
|
|
|
9ae3a8 |
+ uint32_t block_size;
|
|
|
9ae3a8 |
+ uint32_t sub_hdr_size;
|
|
|
9ae3a8 |
+ uint32_t bitmap_blocks;
|
|
|
9ae3a8 |
+ uint32_t status = 0;
|
|
|
9ae3a8 |
+ uint64_t offset_note;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* write common header, the version of kdump-compressed format is 6th */
|
|
|
9ae3a8 |
+ size = sizeof(DiskDumpHeader64);
|
|
|
9ae3a8 |
+ dh = g_malloc0(size);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE));
|
|
|
9ae3a8 |
+ dh->header_version = cpu_convert_to_target32(6, endian);
|
|
|
9ae3a8 |
+ block_size = s->page_size;
|
|
|
9ae3a8 |
+ dh->block_size = cpu_convert_to_target32(block_size, endian);
|
|
|
9ae3a8 |
+ sub_hdr_size = sizeof(struct KdumpSubHeader64) + s->note_size;
|
|
|
9ae3a8 |
+ sub_hdr_size = DIV_ROUND_UP(sub_hdr_size, block_size);
|
|
|
9ae3a8 |
+ dh->sub_hdr_size = cpu_convert_to_target32(sub_hdr_size, endian);
|
|
|
9ae3a8 |
+ /* dh->max_mapnr may be truncated, full 64bit is in kh.max_mapnr_64 */
|
|
|
9ae3a8 |
+ dh->max_mapnr = cpu_convert_to_target32(MIN(s->max_mapnr, UINT_MAX),
|
|
|
9ae3a8 |
+ endian);
|
|
|
9ae3a8 |
+ dh->nr_cpus = cpu_convert_to_target32(s->nr_cpus, endian);
|
|
|
9ae3a8 |
+ bitmap_blocks = DIV_ROUND_UP(s->len_dump_bitmap, block_size) * 2;
|
|
|
9ae3a8 |
+ dh->bitmap_blocks = cpu_convert_to_target32(bitmap_blocks, endian);
|
|
|
9ae3a8 |
+ memcpy(&(dh->utsname.machine), "x86_64", 6);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (s->flag_compress & DUMP_DH_COMPRESSED_ZLIB) {
|
|
|
9ae3a8 |
+ status |= DUMP_DH_COMPRESSED_ZLIB;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+#ifdef CONFIG_LZO
|
|
|
9ae3a8 |
+ if (s->flag_compress & DUMP_DH_COMPRESSED_LZO) {
|
|
|
9ae3a8 |
+ status |= DUMP_DH_COMPRESSED_LZO;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+#endif
|
|
|
9ae3a8 |
+#ifdef CONFIG_SNAPPY
|
|
|
9ae3a8 |
+ if (s->flag_compress & DUMP_DH_COMPRESSED_SNAPPY) {
|
|
|
9ae3a8 |
+ status |= DUMP_DH_COMPRESSED_SNAPPY;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+#endif
|
|
|
9ae3a8 |
+ dh->status = cpu_convert_to_target32(status, endian);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (write_buffer(s->fd, 0, dh, size) < 0) {
|
|
|
9ae3a8 |
+ dump_error(s, "dump: failed to write disk dump header.\n");
|
|
|
9ae3a8 |
+ ret = -1;
|
|
|
9ae3a8 |
+ goto out;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* write sub header */
|
|
|
9ae3a8 |
+ size = sizeof(KdumpSubHeader64);
|
|
|
9ae3a8 |
+ kh = g_malloc0(size);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* 64bit max_mapnr_64 */
|
|
|
9ae3a8 |
+ kh->max_mapnr_64 = cpu_convert_to_target64(s->max_mapnr, endian);
|
|
|
9ae3a8 |
+ kh->phys_base = cpu_convert_to_target64(PHYS_BASE, endian);
|
|
|
9ae3a8 |
+ kh->dump_level = cpu_convert_to_target32(DUMP_LEVEL, endian);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ offset_note = DISKDUMP_HEADER_BLOCKS * block_size + size;
|
|
|
9ae3a8 |
+ kh->offset_note = cpu_convert_to_target64(offset_note, endian);
|
|
|
9ae3a8 |
+ kh->note_size = cpu_convert_to_target64(s->note_size, endian);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (write_buffer(s->fd, DISKDUMP_HEADER_BLOCKS *
|
|
|
9ae3a8 |
+ block_size, kh, size) < 0) {
|
|
|
9ae3a8 |
+ dump_error(s, "dump: failed to write kdump sub header.\n");
|
|
|
9ae3a8 |
+ ret = -1;
|
|
|
9ae3a8 |
+ goto out;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* write note */
|
|
|
9ae3a8 |
+ s->note_buf = g_malloc0(s->note_size);
|
|
|
9ae3a8 |
+ s->note_buf_offset = 0;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* use s->note_buf to store notes temporarily */
|
|
|
9ae3a8 |
+ if (write_elf64_notes(buf_write_note, s) < 0) {
|
|
|
9ae3a8 |
+ ret = -1;
|
|
|
9ae3a8 |
+ goto out;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (write_buffer(s->fd, offset_note, s->note_buf,
|
|
|
9ae3a8 |
+ s->note_size) < 0) {
|
|
|
9ae3a8 |
+ dump_error(s, "dump: failed to write notes");
|
|
|
9ae3a8 |
+ ret = -1;
|
|
|
9ae3a8 |
+ goto out;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* get offset of dump_bitmap */
|
|
|
9ae3a8 |
+ s->offset_dump_bitmap = (DISKDUMP_HEADER_BLOCKS + sub_hdr_size) *
|
|
|
9ae3a8 |
+ block_size;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* get offset of page */
|
|
|
9ae3a8 |
+ s->offset_page = (DISKDUMP_HEADER_BLOCKS + sub_hdr_size + bitmap_blocks) *
|
|
|
9ae3a8 |
+ block_size;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+out:
|
|
|
9ae3a8 |
+ g_free(dh);
|
|
|
9ae3a8 |
+ g_free(kh);
|
|
|
9ae3a8 |
+ g_free(s->note_buf);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ return ret;
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+static int write_dump_header(DumpState *s)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ if (s->dump_info.d_machine == EM_386) {
|
|
|
9ae3a8 |
+ return create_header32(s);
|
|
|
9ae3a8 |
+ } else {
|
|
|
9ae3a8 |
+ return create_header64(s);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
static ram_addr_t get_start_block(DumpState *s)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
GuestPhysBlock *block;
|
|
|
9ae3a8 |
diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h
|
|
|
9ae3a8 |
index 995bf47..dfee238 100644
|
|
|
9ae3a8 |
--- a/include/sysemu/dump.h
|
|
|
9ae3a8 |
+++ b/include/sysemu/dump.h
|
|
|
9ae3a8 |
@@ -27,6 +27,19 @@
|
|
|
9ae3a8 |
#define pfn_to_paddr(X, page_shift) \
|
|
|
9ae3a8 |
(((unsigned long long)(X) + ARCH_PFN_OFFSET) << (page_shift))
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+/*
|
|
|
9ae3a8 |
+ * flag for compressed format
|
|
|
9ae3a8 |
+ */
|
|
|
9ae3a8 |
+#define DUMP_DH_COMPRESSED_ZLIB (0x1)
|
|
|
9ae3a8 |
+#define DUMP_DH_COMPRESSED_LZO (0x2)
|
|
|
9ae3a8 |
+#define DUMP_DH_COMPRESSED_SNAPPY (0x4)
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+#define KDUMP_SIGNATURE "KDUMP "
|
|
|
9ae3a8 |
+#define SIG_LEN (sizeof(KDUMP_SIGNATURE) - 1)
|
|
|
9ae3a8 |
+#define PHYS_BASE (0)
|
|
|
9ae3a8 |
+#define DUMP_LEVEL (1)
|
|
|
9ae3a8 |
+#define DISKDUMP_HEADER_BLOCKS (1)
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
typedef struct ArchDumpInfo {
|
|
|
9ae3a8 |
int d_machine; /* Architecture */
|
|
|
9ae3a8 |
int d_endian; /* ELFDATA2LSB or ELFDATA2MSB */
|
|
|
9ae3a8 |
@@ -44,6 +57,89 @@ typedef struct QEMU_PACKED MakedumpfileDataHeader {
|
|
|
9ae3a8 |
int64_t buf_size;
|
|
|
9ae3a8 |
} MakedumpfileDataHeader;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+typedef struct QEMU_PACKED NewUtsname {
|
|
|
9ae3a8 |
+ char sysname[65];
|
|
|
9ae3a8 |
+ char nodename[65];
|
|
|
9ae3a8 |
+ char release[65];
|
|
|
9ae3a8 |
+ char version[65];
|
|
|
9ae3a8 |
+ char machine[65];
|
|
|
9ae3a8 |
+ char domainname[65];
|
|
|
9ae3a8 |
+} NewUtsname;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+typedef struct QEMU_PACKED DiskDumpHeader32 {
|
|
|
9ae3a8 |
+ char signature[SIG_LEN]; /* = "KDUMP " */
|
|
|
9ae3a8 |
+ uint32_t header_version; /* Dump header version */
|
|
|
9ae3a8 |
+ NewUtsname utsname; /* copy of system_utsname */
|
|
|
9ae3a8 |
+ char timestamp[10]; /* Time stamp */
|
|
|
9ae3a8 |
+ uint32_t status; /* Above flags */
|
|
|
9ae3a8 |
+ uint32_t block_size; /* Size of a block in byte */
|
|
|
9ae3a8 |
+ uint32_t sub_hdr_size; /* Size of arch dependent header in block */
|
|
|
9ae3a8 |
+ uint32_t bitmap_blocks; /* Size of Memory bitmap in block */
|
|
|
9ae3a8 |
+ uint32_t max_mapnr; /* = max_mapnr ,
|
|
|
9ae3a8 |
+ obsoleted in header_version 6 */
|
|
|
9ae3a8 |
+ uint32_t total_ram_blocks; /* Number of blocks should be written */
|
|
|
9ae3a8 |
+ uint32_t device_blocks; /* Number of total blocks in dump device */
|
|
|
9ae3a8 |
+ uint32_t written_blocks; /* Number of written blocks */
|
|
|
9ae3a8 |
+ uint32_t current_cpu; /* CPU# which handles dump */
|
|
|
9ae3a8 |
+ uint32_t nr_cpus; /* Number of CPUs */
|
|
|
9ae3a8 |
+} DiskDumpHeader32;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+typedef struct QEMU_PACKED DiskDumpHeader64 {
|
|
|
9ae3a8 |
+ char signature[SIG_LEN]; /* = "KDUMP " */
|
|
|
9ae3a8 |
+ uint32_t header_version; /* Dump header version */
|
|
|
9ae3a8 |
+ NewUtsname utsname; /* copy of system_utsname */
|
|
|
9ae3a8 |
+ char timestamp[22]; /* Time stamp */
|
|
|
9ae3a8 |
+ uint32_t status; /* Above flags */
|
|
|
9ae3a8 |
+ uint32_t block_size; /* Size of a block in byte */
|
|
|
9ae3a8 |
+ uint32_t sub_hdr_size; /* Size of arch dependent header in block */
|
|
|
9ae3a8 |
+ uint32_t bitmap_blocks; /* Size of Memory bitmap in block */
|
|
|
9ae3a8 |
+ uint32_t max_mapnr; /* = max_mapnr,
|
|
|
9ae3a8 |
+ obsoleted in header_version 6 */
|
|
|
9ae3a8 |
+ uint32_t total_ram_blocks; /* Number of blocks should be written */
|
|
|
9ae3a8 |
+ uint32_t device_blocks; /* Number of total blocks in dump device */
|
|
|
9ae3a8 |
+ uint32_t written_blocks; /* Number of written blocks */
|
|
|
9ae3a8 |
+ uint32_t current_cpu; /* CPU# which handles dump */
|
|
|
9ae3a8 |
+ uint32_t nr_cpus; /* Number of CPUs */
|
|
|
9ae3a8 |
+} DiskDumpHeader64;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+typedef struct QEMU_PACKED KdumpSubHeader32 {
|
|
|
9ae3a8 |
+ uint32_t phys_base;
|
|
|
9ae3a8 |
+ uint32_t dump_level; /* header_version 1 and later */
|
|
|
9ae3a8 |
+ uint32_t split; /* header_version 2 and later */
|
|
|
9ae3a8 |
+ uint32_t start_pfn; /* header_version 2 and later,
|
|
|
9ae3a8 |
+ obsoleted in header_version 6 */
|
|
|
9ae3a8 |
+ uint32_t end_pfn; /* header_version 2 and later,
|
|
|
9ae3a8 |
+ obsoleted in header_version 6 */
|
|
|
9ae3a8 |
+ uint64_t offset_vmcoreinfo; /* header_version 3 and later */
|
|
|
9ae3a8 |
+ uint32_t size_vmcoreinfo; /* header_version 3 and later */
|
|
|
9ae3a8 |
+ uint64_t offset_note; /* header_version 4 and later */
|
|
|
9ae3a8 |
+ uint32_t note_size; /* header_version 4 and later */
|
|
|
9ae3a8 |
+ uint64_t offset_eraseinfo; /* header_version 5 and later */
|
|
|
9ae3a8 |
+ uint32_t size_eraseinfo; /* header_version 5 and later */
|
|
|
9ae3a8 |
+ uint64_t start_pfn_64; /* header_version 6 and later */
|
|
|
9ae3a8 |
+ uint64_t end_pfn_64; /* header_version 6 and later */
|
|
|
9ae3a8 |
+ uint64_t max_mapnr_64; /* header_version 6 and later */
|
|
|
9ae3a8 |
+} KdumpSubHeader32;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+typedef struct QEMU_PACKED KdumpSubHeader64 {
|
|
|
9ae3a8 |
+ uint64_t phys_base;
|
|
|
9ae3a8 |
+ uint32_t dump_level; /* header_version 1 and later */
|
|
|
9ae3a8 |
+ uint32_t split; /* header_version 2 and later */
|
|
|
9ae3a8 |
+ uint64_t start_pfn; /* header_version 2 and later,
|
|
|
9ae3a8 |
+ obsoleted in header_version 6 */
|
|
|
9ae3a8 |
+ uint64_t end_pfn; /* header_version 2 and later,
|
|
|
9ae3a8 |
+ obsoleted in header_version 6 */
|
|
|
9ae3a8 |
+ uint64_t offset_vmcoreinfo; /* header_version 3 and later */
|
|
|
9ae3a8 |
+ uint64_t size_vmcoreinfo; /* header_version 3 and later */
|
|
|
9ae3a8 |
+ uint64_t offset_note; /* header_version 4 and later */
|
|
|
9ae3a8 |
+ uint64_t note_size; /* header_version 4 and later */
|
|
|
9ae3a8 |
+ uint64_t offset_eraseinfo; /* header_version 5 and later */
|
|
|
9ae3a8 |
+ uint64_t size_eraseinfo; /* header_version 5 and later */
|
|
|
9ae3a8 |
+ uint64_t start_pfn_64; /* header_version 6 and later */
|
|
|
9ae3a8 |
+ uint64_t end_pfn_64; /* header_version 6 and later */
|
|
|
9ae3a8 |
+ uint64_t max_mapnr_64; /* header_version 6 and later */
|
|
|
9ae3a8 |
+} KdumpSubHeader64;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
struct GuestPhysBlockList; /* memory_mapping.h */
|
|
|
9ae3a8 |
int cpu_get_dump_info(ArchDumpInfo *info,
|
|
|
9ae3a8 |
const struct GuestPhysBlockList *guest_phys_blocks);
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|