This patch applies on top of patch "initial note of excluded page structures".
A time and diskspace option of makedumpfile is to exclude unused
vemmap page structures.
Certain crash commands will fail if they search free page
lists.
They fail with some hint of the problem:
9 2048k ffff8800000133b0 kmem: page excluded: kernel virtual address:
ffffea0000007028 type: "first list entry"
This patch further explains to the user why certain kmem options fail:
kmem -f
kmem -F
kmem -s|-S addr
Or may give incomplete results:
kmem -i
Signed-off-by: Cliff Wickman <cpw(a)sgi.com>
---
diskdump.c | 5 ++++-
memory.c | 33 ++++++++++++++++++++++++++++++---
2 files changed, 34 insertions(+), 4 deletions(-)
Index: crash-7.0.4/memory.c
===================================================================
--- crash-7.0.4.orig/memory.c
+++ crash-7.0.4/memory.c
@@ -20,6 +20,8 @@
#include <sys/mman.h>
#include <ctype.h>
#include <netinet/in.h>
+extern int vmemmmap_excluded;
+long not_found_excluded = 0;
struct meminfo { /* general purpose memory information structure */
ulong cache; /* used by the various memory searching/dumping */
@@ -2160,6 +2162,7 @@ readmem(ulonglong addr, int memtype, voi
goto readmem_error;
case PAGE_EXCLUDED:
+ not_found_excluded++;
RETURN_ON_PARTIAL_READ();
if (PRINT_ERROR_MESSAGE)
error(INFO, PAGE_EXCLUDED_ERRMSG, memtype_string(memtype, 0),
addr, type);
@@ -4370,7 +4373,9 @@ cmd_kmem(void)
meminfo.spec_addr = value[i];
meminfo.flags = ADDRESS_SPECIFIED;
if (meminfo.calls++)
- fprintf(fp, "\n");
+ fprintf(fp, "\nNote: kmem -f may fail because
"
+ "unused page structures are "
+ "excluded from this dump.\n");
vt->dump_free_pages(&meminfo);
fflag++;
}
@@ -4417,6 +4422,10 @@ cmd_kmem(void)
meminfo.flags = ADDRESS_SPECIFIED;
if (Sflag && (vt->flags & KMALLOC_SLUB))
meminfo.flags |= VERBOSE;
+ if (vmemmmap_excluded)
+ fprintf(fp, "Note: kmem -s|-S may fail because "
+ "unused page structures are "
+ "excluded from this dump.\n");
if (meminfo.calls++)
fprintf(fp, "\n");
vt->dump_kmem_cache(&meminfo);
@@ -4483,17 +4492,35 @@ cmd_kmem(void)
}
- if (iflag == 1)
+ if (iflag == 1) {
+ not_found_excluded = 0;
dump_kmeminfo();
+ if (not_found_excluded) {
+ fprintf(fp, "\nNote: %ld free pages not found (excluded); "
+ "results are incomplete.\n", not_found_excluded);
+ if (vmemmmap_excluded)
+ fprintf(fp, "Unused page structures are "
+ "excluded from this dump.\n");
+ }
+ }
if (pflag == 1)
dump_mem_map(&meminfo);
- if (fflag == 1)
+ if (fflag == 1) {
+ if (vmemmmap_excluded)
+ fprintf(fp, "Note: kmem -f may fail because "
+ "unused page structures are "
+ "excluded from this dump.\n");
vt->dump_free_pages(&meminfo);
+ }
if (Fflag == 1) {
meminfo.flags = VERBOSE;
+ if (vmemmmap_excluded)
+ fprintf(fp, "Note: kmem -F may fail because "
+ "unused page structures are "
+ "excluded from this dump.\n");
vt->dump_free_pages(&meminfo);
}
Index: crash-7.0.4/diskdump.c
===================================================================
--- crash-7.0.4.orig/diskdump.c
+++ crash-7.0.4/diskdump.c
@@ -25,6 +25,7 @@
#include "defs.h"
#include "diskdump.h"
+int vmemmmap_excluded = 0;
#define BITMAP_SECT_LEN 4096
@@ -749,9 +750,11 @@ restart:
dd->valid_pages[i]++;
}
- if (header->status & DUMP_DH_EXCLUDED_VMEMMAP)
+ if (header->status & DUMP_DH_EXCLUDED_VMEMMAP) {
fprintf(fp,
"NOTE: Unused vmemmap page structures are excluded from this dump.\n");
+ vmemmmap_excluded = 1;
+ }
return TRUE;