Hello Dave, The patch is used to display qemu note of compressed qemu memory dump. It is against the newest git. Please check. -- Regards Qiao Nuohan
>From 8e89658701cf1172137069aa6079df11fdbbb8da Mon Sep 17 00:00:00 2001 From: Qiao Nuohan <qiaonuohan@xxxxxxxxxxxxxx> Date: Mon, 22 Dec 2014 10:49:52 +0800 Subject: [PATCH] qemu note --- diskdump.c | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/diskdump.c b/diskdump.c index 17fba1b..d1e3895 100644 --- a/diskdump.c +++ b/diskdump.c @@ -54,6 +54,8 @@ struct diskdump_data { unsigned char *notes_buf; /* copy of elf notes */ void **nt_prstatus_percpu; uint num_prstatus_notes; + void **nt_qemu_percpu; + uint num_qemu_notes; /* page cache */ struct page_cache_hdr { /* header for each cached page */ @@ -247,7 +249,7 @@ process_elf32_notes(void *note_buf, unsigned long size_note) Elf32_Nhdr *nt; size_t index, len = 0; int num = 0; - + int qemu_num = 0; for (index = 0; index < size_note; index += len) { nt = note_buf + index; @@ -257,8 +259,10 @@ process_elf32_notes(void *note_buf, unsigned long size_note) num++; } len = sizeof(Elf32_Nhdr); - if (STRNEQ((char *)nt + len, "QEMU")) - pc->flags2 |= QEMU_MEM_DUMP_COMPRESSED; + if (STRNEQ((char *)nt + len, "QEMU")) { + dd->nt_qemu_percpu[qemu_num] = nt; + qemu_num++; + } len = roundup(len + nt->n_namesz, 4); len = roundup(len + nt->n_descsz, 4); } @@ -267,6 +271,11 @@ process_elf32_notes(void *note_buf, unsigned long size_note) pc->flags2 |= ELF_NOTES; dd->num_prstatus_notes = num; } + + if (qemu_num > 0) { + pc->flags2 |= QEMU_MEM_DUMP_COMPRESSED; + dd->num_qemu_notes = qemu_num; + } return; } @@ -276,6 +285,7 @@ process_elf64_notes(void *note_buf, unsigned long size_note) Elf64_Nhdr *nt; size_t index, len = 0; int num = 0; + int qemu_num = 0; for (index = 0; index < size_note; index += len) { nt = note_buf + index; @@ -285,8 +295,11 @@ process_elf64_notes(void *note_buf, unsigned long size_note) num++; } len = sizeof(Elf64_Nhdr); - if (STRNEQ((char *)nt + len, "QEMU")) - pc->flags2 |= QEMU_MEM_DUMP_COMPRESSED; + if (STRNEQ((char *)nt + len, "QEMU")) { + dd->nt_qemu_percpu[qemu_num] = nt; + qemu_num++; + } + len = roundup(len + nt->n_namesz, 4); len = roundup(len + nt->n_descsz, 4); } @@ -295,6 +308,11 @@ process_elf64_notes(void *note_buf, unsigned long size_note) pc->flags2 |= ELF_NOTES; dd->num_prstatus_notes = num; } + + if (qemu_num > 0) { + pc->flags2 |= QEMU_MEM_DUMP_COMPRESSED; + dd->num_qemu_notes = qemu_num; + } return; } @@ -688,6 +706,10 @@ restart: error(FATAL, "compressed kdump: cannot malloc pointer" " to NT_PRSTATUS notes\n"); + if ((dd->nt_qemu_percpu = malloc(NR_CPUS * sizeof(void*))) == NULL) + error(FATAL, "qemu mem dump compressed: cannot malloc pointer" + " to QEMU notes\n"); + if (FLAT_FORMAT()) { if (!read_flattened_format(dd->dfd, offset, dd->notes_buf, size)) { error(INFO, "compressed kdump: cannot read notes data" @@ -777,6 +799,8 @@ err: free(dd->notes_buf); if (dd->nt_prstatus_percpu) free(dd->nt_prstatus_percpu); + if (dd->nt_qemu_percpu) + free(dd->nt_qemu_percpu); dd->flags &= ~(DISKDUMP_LOCAL|KDUMP_CMPRS_LOCAL); pc->flags2 &= ~ELF_NOTES; @@ -1746,6 +1770,12 @@ __diskdump_memory_dump(FILE *fp) dd->nt_prstatus_percpu[i], fp); } dump_nt_prstatus_offset(fp); + for (i = 0; i < dd->num_qemu_notes; i++) { + fprintf(fp, " notes[%d]: %lx (QEMU)\n", + i, (ulong)dd->nt_qemu_percpu[i]); + display_ELF_note(dd->machine_type, QEMU_NOTE, + dd->nt_qemu_percpu[i], fp); + } } if (dh->header_version >= 5) { fprintf(fp, " offset_eraseinfo: %llu (0x%llx)\n", -- 1.8.5.3
-- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility