Added recognition of the new DUMP_DH_EXCLUDED_VMEMMAP flag in the

header of compressed kdumps, which is set by the new -e option to
the makedumpfile(8) facility.  The -e option excludes kernel pages
that contain nothing but kernel page structures for pages that are
not being included in the dump.  If the bit is set in the dumpfile,
the crash utility will issue a warning that the dumpfile is known to
be incomplete during initialization, just prior to the system banner
display.
(anderson@redhat.com)
This commit is contained in:
Dave Anderson 2015-10-29 14:43:45 -04:00
parent 3ed7a4e788
commit 7ce8469f8b
5 changed files with 32 additions and 5 deletions

2
defs.h
View File

@ -519,6 +519,8 @@ struct program_context {
#define is_incomplete_dump() (pc->flags2 & INCOMPLETE_DUMP)
#define QEMU_MEM_DUMP_COMPRESSED (0x10000ULL)
#define SNAP (0x20000ULL)
#define EXCLUDED_VMEMMAP (0x40000ULL)
#define is_excluded_vmemmap() (pc->flags2 & EXCLUDED_VMEMMAP)
char *cleanup;
char *namelist_orig;
char *namelist_debug_orig;

View File

@ -793,6 +793,10 @@ restart:
(dd->header->status & DUMP_DH_COMPRESSED_INCOMPLETE))
pc->flags2 |= INCOMPLETE_DUMP;
if (KDUMP_CMPRS_VALID() &&
(dd->header->status & DUMP_DH_EXCLUDED_VMEMMAP))
pc->flags2 |= EXCLUDED_VMEMMAP;
/* For split dumpfile */
if (KDUMP_CMPRS_VALID()) {
is_split = ((dd->header->header_version >= 2) &&
@ -1722,6 +1726,8 @@ __diskdump_memory_dump(FILE *fp)
fprintf(fp, "DUMP_DH_COMPRESSED_SNAPPY");
if (dh->status & DUMP_DH_COMPRESSED_INCOMPLETE)
fprintf(fp, "DUMP_DH_COMPRESSED_INCOMPLETE");
if (dh->status & DUMP_DH_EXCLUDED_VMEMMAP)
fprintf(fp, "DUMP_DH_EXCLUDED_VMEMMAP");
break;
}
fprintf(fp, ")\n");
@ -2023,12 +2029,14 @@ show_split_dumpfiles(void)
for (i = 0; i < num_dumpfiles; i++) {
ddp = dd_list[i];
dh = ddp->header;
fprintf(fp, "%s%s%s%s",
fprintf(fp, "%s%s%s%s%s",
i ? " " : "",
ddp->filename,
is_partial_diskdump() ? " [PARTIAL DUMP]" : "",
dh->status & DUMP_DH_COMPRESSED_INCOMPLETE ?
" [INCOMPLETE]" : "");
" [INCOMPLETE]" : "",
dh->status & DUMP_DH_EXCLUDED_VMEMMAP ?
" [EXCLUDED VMEMMAP]" : "");
if ((i+1) < num_dumpfiles)
fprintf(fp, "\n");
}

View File

@ -85,6 +85,7 @@ struct kdump_sub_header {
#define DUMP_DH_COMPRESSED_LZO 0x2 /* page is compressed with lzo */
#define DUMP_DH_COMPRESSED_SNAPPY 0x4 /* page is compressed with snappy */
#define DUMP_DH_COMPRESSED_INCOMPLETE 0x8 /* dumpfile is incomplete */
#define DUMP_DH_EXCLUDED_VMEMMAP 0x10 /* unused vmemmap pages are excluded */
/* descriptor of each page for vmcore */
typedef struct page_desc {

View File

@ -5086,12 +5086,16 @@ display_sys_stats(void)
fprintf(fp, " [INCOMPLETE]");
if (DISKDUMP_DUMPFILE() && !dumpfile_is_split() &&
(is_partial_diskdump() || is_incomplete_dump())) {
fprintf(fp, " %s%s",
(is_partial_diskdump() || is_incomplete_dump() ||
is_excluded_vmemmap())) {
fprintf(fp, " %s%s%s",
is_partial_diskdump() ?
" [PARTIAL DUMP]" : "",
is_incomplete_dump() ?
" [INCOMPLETE]" : "");
" [INCOMPLETE]" : "",
is_excluded_vmemmap() ?
" [EXCLUDED VMEMMAP]" : "");
}
fprintf(fp, "\n");

12
main.c
View File

@ -730,6 +730,16 @@ main_loop(void)
" will return zero-filled memory.\n");
}
if (pc->flags2 & EXCLUDED_VMEMMAP) {
error(WARNING, "\n%s:\n "
"This dumpfile is incomplete because the page structures associated\n"
" with excluded pages may also be excluded. This may cause the crash\n"
" session to fail entirely, may cause commands to fail (most notably\n"
" the \"kmem\" command), or may result in unpredictable runtime behavior.\n",
pc->dumpfile);
}
if (!(pc->flags & GDB_INIT)) {
gdb_session_init();
show_untrusted_files();
@ -1446,6 +1456,8 @@ dump_program_context(void)
fprintf(fp, "%sINCOMPLETE_DUMP", others++ ? "|" : "");
if (pc->flags2 & SNAP)
fprintf(fp, "%sSNAP", others++ ? "|" : "");
if (pc->flags2 & EXCLUDED_VMEMMAP)
fprintf(fp, "%sEXCLUDED_VMEMMAP", others++ ? "|" : "");
fprintf(fp, ")\n");
fprintf(fp, " namelist: %s\n", pc->namelist);