Rebase makedumpfile-1.5.5

Signed-off-by: WANG Chao <chaowang@redhat.com>
This commit is contained in:
WANG Chao 2014-01-28 13:03:06 +08:00
parent 59b1229661
commit 6ae85f33a7
18 changed files with 11 additions and 2072 deletions

1
.gitignore vendored
View File

@ -13,3 +13,4 @@ makedumpfile-1.3.5.tar.gz
/kexec-tools-2.0.4.tar.bz2
/makedumpfile-1.5.4.tar.gz
/kexec-tools-po-20131224.tgz
/makedumpfile-1.5.5.tar.gz

View File

@ -1,5 +1,5 @@
--- kexec-tools-2.0.3/makedumpfile-1.5.4/Makefile.orig
+++ kexec-tools-2.0.3/makedumpfile-1.5.4/Makefile
--- kexec-tools-2.0.3/makedumpfile-1.5.5/Makefile.orig
+++ kexec-tools-2.0.3/makedumpfile-1.5.5/Makefile
@@ -60,7 +60,7 @@ LIBS := -lsnappy $(LIBS)
CFLAGS += -DUSESNAPPY
endif

View File

@ -1,43 +0,0 @@
From eb708cedde4ed48dde5a918a23b2c3b8235df6c5 Mon Sep 17 00:00:00 2001
From: Baoquan He <bhe@redhat.com>
Date: Tue, 2 Jul 2013 11:11:07 +0900
Subject: [PATCH 2/2] [PATCH 2/2] Add help and man message for '--help'.
Conventionally '-h' and '--help' are all provided. Currently makedumpfile
lacks help and man message for '--help'. Here add it.
Signed-off-by: Baoquan He <bhe@redhat.com>
---
makedumpfile.8 | 2 +-
print_info.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/makedumpfile-1.5.4/makedumpfile.8 b/makedumpfile-1.5.4/makedumpfile.8
index adeb811..f50a011 100644
--- a/makedumpfile-1.5.4/makedumpfile.8
+++ b/makedumpfile-1.5.4/makedumpfile.8
@@ -539,7 +539,7 @@ order from left to right. \fIVMCORE\fRs are assembled into a single
Print debugging message.
.TP
-\fB\-h\fR
+\fB\-h (\-\-help)\fR
Show help message and LZO/snappy support status (enabled/disabled).
.TP
diff --git a/makedumpfile-1.5.4/print_info.c b/makedumpfile-1.5.4/print_info.c
index 06939e0..3527970 100644
--- a/makedumpfile-1.5.4/print_info.c
+++ b/makedumpfile-1.5.4/print_info.c
@@ -255,7 +255,7 @@ print_usage(void)
MSG(" [-f]:\n");
MSG(" Overwrite DUMPFILE even if it already exists.\n");
MSG("\n");
- MSG(" [-h]:\n");
+ MSG(" [-h, --help]:\n");
MSG(" Show help message and LZO/snappy support status (enabled/disabled).\n");
MSG("\n");
MSG(" [-v]:\n");
--
1.8.4.2

View File

@ -1,161 +0,0 @@
From a895dc8f2a17f7dac9d3d63de1cea4720557625d Mon Sep 17 00:00:00 2001
From: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
Date: Thu, 12 Dec 2013 16:40:12 +0900
Subject: [PATCH 1/2] [PATCH] Add --non-mmap option to disable mmap() manually.
When --non-mmap option is specified, makedumpfile doesn't use
mmap() even if /proc/vmcore supports mmap().
Signed-off-by: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
---
makedumpfile.8 | 11 +++++++++++
makedumpfile.c | 29 +++++++++++++++++++----------
makedumpfile.h | 9 +++++++++
print_info.c | 6 ++++++
4 files changed, 45 insertions(+), 10 deletions(-)
diff --git a/makedumpfile-1.5.4/makedumpfile.8 b/makedumpfile-1.5.4/makedumpfile.8
index f50a011..227b6f7 100644
--- a/makedumpfile-1.5.4/makedumpfile.8
+++ b/makedumpfile-1.5.4/makedumpfile.8
@@ -395,6 +395,17 @@ If you feel the cyclic mode is too slow, please try this mode.
# makedumpfile \-\-non\-cyclic \-d 31 \-x vmlinux /proc/vmcore dumpfile
.TP
+\fB\-\-non\-mmap\fR
+Never use \fBmmap(2)\fR to read \fIVMCORE\fR even if it supports \fBmmap(2)\fR.
+Generally, reading \fIVMCORE\fR with \fBmmap(2)\fR is faster than without it,
+so ordinary users don't need to specify this option.
+This option is mainly for debugging.
+.br
+.B Example:
+.br
+# makedumpfile \-\-non\-mmap \-d 31 \-x vmlinux /proc/vmcore dumpfile
+
+.TP
\fB\-\-xen-syms\fR \fIXEN-SYMS\fR
Specify the \fIXEN-SYMS\fR with debug information to analyze the xen's memory usage.
This option extracts the part of xen and domain-0.
diff --git a/makedumpfile-1.5.4/makedumpfile.c b/makedumpfile-1.5.4/makedumpfile.c
index 600fb5d..b3af28b 100644
--- a/makedumpfile-1.5.4/makedumpfile.c
+++ b/makedumpfile-1.5.4/makedumpfile.c
@@ -272,7 +272,7 @@ update_mmap_range(off_t offset, int initial) {
static int
is_mapped_with_mmap(off_t offset) {
- if (info->flag_usemmap
+ if (info->flag_usemmap == MMAP_ENABLE
&& offset >= info->mmap_start_offset
&& offset < info->mmap_end_offset)
return TRUE;
@@ -320,7 +320,7 @@ read_from_vmcore(off_t offset, void *bufptr, unsigned long size)
{
const off_t failed = (off_t)-1;
- if (info->flag_usemmap) {
+ if (info->flag_usemmap == MMAP_ENABLE) {
if (!read_with_mmap(offset, bufptr, size)) {
ERRMSG("Can't read the dump memory(%s) with mmap().\n",
info->name_memory);
@@ -3175,14 +3175,14 @@ out:
if (info->dump_level & DL_EXCLUDE_FREE)
setup_page_is_buddy();
- if (!initialize_mmap()) {
- /* this kernel does not support mmap of vmcore */
- DEBUG_MSG("Kernel can't mmap vmcore, using reads.\n");
- info->flag_usemmap = FALSE;
+ if (info->flag_usemmap == MMAP_TRY && initialize_mmap()) {
+ DEBUG_MSG("mmap() is available on the kernel.\n");
+ info->flag_usemmap = MMAP_ENABLE;
} else {
- DEBUG_MSG("read %s with mmap()\n", info->name_memory);
- info->flag_usemmap = TRUE;
- }
+ DEBUG_MSG("The kernel doesn't support mmap(),");
+ DEBUG_MSG("read() will be used instead.\n");
+ info->flag_usemmap = MMAP_DISABLE;
+ }
return TRUE;
}
@@ -8947,6 +8947,7 @@ static struct option longopts[] = {
{"non-cyclic", no_argument, NULL, OPT_NON_CYCLIC},
{"cyclic-buffer", required_argument, NULL, OPT_CYCLIC_BUFFER},
{"eppic", required_argument, NULL, OPT_EPPIC},
+ {"non-mmap", no_argument, NULL, OPT_NON_MMAP},
{0, 0, 0, 0}
};
@@ -8972,7 +8973,12 @@ main(int argc, char *argv[])
* By default, makedumpfile works in constant memory space.
*/
info->flag_cyclic = TRUE;
-
+
+ /*
+ * By default, makedumpfile try to use mmap(2) to read /proc/vmcore.
+ */
+ info->flag_usemmap = MMAP_TRY;
+
info->block_order = DEFAULT_ORDER;
message_level = DEFAULT_MSG_LEVEL;
while ((opt = getopt_long(argc, argv, "b:cDd:EFfg:hi:lpRvXx:", longopts,
@@ -9069,6 +9075,9 @@ main(int argc, char *argv[])
case OPT_NON_CYCLIC:
info->flag_cyclic = FALSE;
break;
+ case OPT_NON_MMAP:
+ info->flag_usemmap = MMAP_DISABLE;
+ break;
case OPT_XEN_VMCOREINFO:
info->flag_read_vmcoreinfo = 1;
info->name_vmcoreinfo = optarg;
diff --git a/makedumpfile-1.5.4/makedumpfile.h b/makedumpfile-1.5.4/makedumpfile.h
index 517e16e..fe88eff 100644
--- a/makedumpfile-1.5.4/makedumpfile.h
+++ b/makedumpfile-1.5.4/makedumpfile.h
@@ -128,6 +128,14 @@ enum {
MADDR_XEN
};
+/*
+ * State of mmap(2)
+ */
+enum {
+ MMAP_DISABLE,
+ MMAP_TRY,
+ MMAP_ENABLE,
+};
static inline int
test_bit(int nr, unsigned long addr)
@@ -1741,6 +1749,7 @@ struct elf_prstatus {
#define OPT_NON_CYCLIC OPT_START+10
#define OPT_CYCLIC_BUFFER OPT_START+11
#define OPT_EPPIC OPT_START+12
+#define OPT_NON_MMAP OPT_START+13
/*
* Function Prototype.
diff --git a/makedumpfile-1.5.4/print_info.c b/makedumpfile-1.5.4/print_info.c
index d7a8600..90b6cee 100644
--- a/makedumpfile-1.5.4/print_info.c
+++ b/makedumpfile-1.5.4/print_info.c
@@ -196,6 +196,12 @@ print_usage(void)
MSG(" same as v1.4.4 or before.\n");
MSG(" If you feel the cyclic mode is too slow, please try this mode.\n");
MSG("\n");
+ MSG(" [--non-mmap]:\n");
+ MSG(" Never use mmap(2) to read VMCORE even if it supports mmap(2).\n");
+ MSG(" Generally, reading VMCORE with mmap(2) is faster than without it,\n");
+ MSG(" so ordinary users don't need to specify this option.\n");
+ MSG(" This option is mainly for debugging.\n");
+ MSG("\n");
MSG(" [--xen-syms XEN-SYMS]:\n");
MSG(" Specify the XEN-SYMS to analyze Xen's memory usage.\n");
MSG("\n");
--
1.8.4.2

View File

@ -1,44 +0,0 @@
From 150b58eb299066c65ef7713a93effc35c00be03a Mon Sep 17 00:00:00 2001
Message-Id: <150b58eb299066c65ef7713a93effc35c00be03a.1374133991.git.bhe@redhat.com>
From: Baoquan He <bhe@redhat.com>
Date: Mon, 15 Jul 2013 20:37:14 +0800
Subject: [PATCH] [PATCH] Add vmap_area_list definition for ppc/ppc64.
vmap_area_list is added to get vmalloc_start for ppc/ppc64, but its
definition is missing, now add them.
Signed-off-by: Baoquan He <bhe@redhat.com>
---
makedumpfile-1.5.4/arch/ppc.c | 2 +-
makedumpfile-1.5.4/arch/ppc64.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/makedumpfile-1.5.4/arch/ppc.c b/makedumpfile-1.5.4/arch/ppc.c
index a9b4812..a3e1a12 100644
--- a/makedumpfile-1.5.4/arch/ppc.c
+++ b/makedumpfile-1.5.4/arch/ppc.c
@@ -28,7 +28,7 @@
int
get_machdep_info_ppc(void)
{
- unsigned long vmlist, vmalloc_start;
+ unsigned long vmlist, vmap_area_list, vmalloc_start;
info->section_size_bits = _SECTION_SIZE_BITS;
info->max_physmem_bits = _MAX_PHYSMEM_BITS;
diff --git a/makedumpfile-1.5.4/arch/ppc64.c b/makedumpfile-1.5.4/arch/ppc64.c
index c229ede..85144f6 100644
--- a/makedumpfile-1.5.4/arch/ppc64.c
+++ b/makedumpfile-1.5.4/arch/ppc64.c
@@ -49,7 +49,7 @@ set_ppc64_max_physmem_bits(void)
int
get_machdep_info_ppc64(void)
{
- unsigned long vmlist, vmalloc_start;
+ unsigned long vmlist, vmap_area_list, vmalloc_start;
info->section_size_bits = _SECTION_SIZE_BITS;
if (!set_ppc64_max_physmem_bits()) {
--
1.7.1

View File

@ -1,244 +0,0 @@
From bd67c1d5e2633f302b4c0ad50cc830ff7da20b2a Mon Sep 17 00:00:00 2001
From: Baoquan He <bhe@redhat.com>
Date: Tue, 2 Jul 2013 11:09:20 +0900
Subject: [PATCH 1/2] [PATCH 1/2] Assign non-printable value as short options.
Characters for short options is limited, and now makedumpfile has
considerably many options. As times go on, no enough reasonable
letters can be assigned to each functionality with short options.
E.g non-cyclic vs Y, cyclic-buffer vs Z, eppic vs S.
Now assign non-printable value to these kind of short optins, meanwhile
define them as indicative MACRO which can make code more readable.
Signed-off-by: Baoquan He <bhe@redhat.com>
---
makedumpfile.c | 88 +++++++++++++++++++++++++++++-----------------------------
makedumpfile.h | 35 +++++++++++++++++++++++
2 files changed, 79 insertions(+), 44 deletions(-)
diff --git a/makedumpfile-1.5.4/makedumpfile.c b/makedumpfile-1.5.4/makedumpfile.c
index b42565c..bb72c66 100644
--- a/makedumpfile-1.5.4/makedumpfile.c
+++ b/makedumpfile-1.5.4/makedumpfile.c
@@ -8555,20 +8555,20 @@ calculate_cyclic_buffer_size(void) {
}
static struct option longopts[] = {
- {"split", no_argument, NULL, 's'},
- {"reassemble", no_argument, NULL, 'r'},
- {"xen-syms", required_argument, NULL, 'y'},
- {"xen-vmcoreinfo", required_argument, NULL, 'z'},
- {"xen_phys_start", required_argument, NULL, 'P'},
- {"message-level", required_argument, NULL, 'm'},
- {"vtop", required_argument, NULL, 'V'},
- {"dump-dmesg", no_argument, NULL, 'M'},
- {"config", required_argument, NULL, 'C'},
- {"help", no_argument, NULL, 'h'},
- {"diskset", required_argument, NULL, 'k'},
- {"non-cyclic", no_argument, NULL, 'Y'},
- {"cyclic-buffer", required_argument, NULL, 'Z'},
- {"eppic", required_argument, NULL, 'S'},
+ {"split", no_argument, NULL, OPT_SPLIT},
+ {"reassemble", no_argument, NULL, OPT_REASSEMBLE},
+ {"xen-syms", required_argument, NULL, OPT_XEN_SYMS},
+ {"xen-vmcoreinfo", required_argument, NULL, OPT_XEN_VMCOREINFO},
+ {"xen_phys_start", required_argument, NULL, OPT_XEN_PHYS_START},
+ {"message-level", required_argument, NULL, OPT_MESSAGE_LEVEL},
+ {"vtop", required_argument, NULL, OPT_VTOP},
+ {"dump-dmesg", no_argument, NULL, OPT_DUMP_DMESG},
+ {"config", required_argument, NULL, OPT_CONFIG},
+ {"help", no_argument, NULL, OPT_HELP},
+ {"diskset", required_argument, NULL, OPT_DISKSET},
+ {"non-cyclic", no_argument, NULL, OPT_NON_CYCLIC},
+ {"cyclic-buffer", required_argument, NULL, OPT_CYCLIC_BUFFER},
+ {"eppic", required_argument, NULL, OPT_EPPIC},
{0, 0, 0, 0}
};
@@ -8597,29 +8597,29 @@ main(int argc, char *argv[])
info->block_order = DEFAULT_ORDER;
message_level = DEFAULT_MSG_LEVEL;
- while ((opt = getopt_long(argc, argv, "b:cDd:EFfg:hi:lMpRrsvXx:", longopts,
+ while ((opt = getopt_long(argc, argv, "b:cDd:EFfg:hi:lpRvXx:", longopts,
NULL)) != -1) {
switch (opt) {
- case 'b':
+ case OPT_BLOCK_ORDER:
info->block_order = atoi(optarg);
break;
- case 'C':
+ case OPT_CONFIG:
info->name_filterconfig = optarg;
break;
- case 'c':
+ case OPT_COMPRESS_ZLIB:
info->flag_compress = DUMP_DH_COMPRESSED_ZLIB;
break;
- case 'D':
+ case OPT_DEBUG:
flag_debug = TRUE;
break;
- case 'd':
+ case OPT_DUMP_LEVEL:
if (!parse_dump_level(optarg))
goto out;
break;
- case 'E':
+ case OPT_ELF_DUMPFILE:
info->flag_elf_dumpfile = 1;
break;
- case 'F':
+ case OPT_FLATTEN:
info->flag_flatten = 1;
/*
* All messages are output to STDERR because STDOUT is
@@ -8627,75 +8627,75 @@ main(int argc, char *argv[])
*/
flag_strerr_message = TRUE;
break;
- case 'f':
+ case OPT_FORCE:
info->flag_force = 1;
break;
- case 'g':
+ case OPT_GENERATE_VMCOREINFO:
info->flag_generate_vmcoreinfo = 1;
info->name_vmcoreinfo = optarg;
break;
- case 'h':
+ case OPT_HELP:
info->flag_show_usage = 1;
break;
- case 'i':
+ case OPT_READ_VMCOREINFO:
info->flag_read_vmcoreinfo = 1;
info->name_vmcoreinfo = optarg;
break;
- case 'k':
+ case OPT_DISKSET:
if (!sadump_add_diskset_info(optarg))
goto out;
info->flag_sadump_diskset = 1;
break;
- case 'l':
+ case OPT_COMPRESS_LZO:
info->flag_compress = DUMP_DH_COMPRESSED_LZO;
break;
- case 'm':
+ case OPT_MESSAGE_LEVEL:
message_level = atoi(optarg);
break;
- case 'M':
+ case OPT_DUMP_DMESG:
info->flag_dmesg = 1;
break;
- case 'p':
+ case OPT_COMPRESS_SNAPPY:
info->flag_compress = DUMP_DH_COMPRESSED_SNAPPY;
break;
- case 'P':
+ case OPT_XEN_PHYS_START:
info->xen_phys_start = strtoul(optarg, NULL, 0);
break;
- case 'R':
+ case OPT_REARRANGE:
info->flag_rearrange = 1;
break;
- case 's':
+ case OPT_SPLIT:
info->flag_split = 1;
break;
- case 'S':
+ case OPT_EPPIC:
info->name_eppic_config = optarg;
break;
- case 'r':
+ case OPT_REASSEMBLE:
info->flag_reassemble = 1;
break;
- case 'V':
+ case OPT_VTOP:
info->vaddr_for_vtop = strtoul(optarg, NULL, 0);
break;
- case 'v':
+ case OPT_VERSION:
info->flag_show_version = 1;
break;
- case 'X':
+ case OPT_EXCLUDE_XEN_DOM:
info->flag_exclude_xen_dom = 1;
break;
- case 'x':
+ case OPT_VMLINUX:
info->name_vmlinux = optarg;
break;
- case 'y':
+ case OPT_XEN_SYMS:
info->name_xen_syms = optarg;
break;
- case 'Y':
+ case OPT_NON_CYCLIC:
info->flag_cyclic = FALSE;
break;
- case 'z':
+ case OPT_XEN_VMCOREINFO:
info->flag_read_vmcoreinfo = 1;
info->name_vmcoreinfo = optarg;
break;
- case 'Z':
+ case OPT_CYCLIC_BUFFER:
info->bufsize_cyclic = atoi(optarg);
break;
case '?':
diff --git a/makedumpfile-1.5.4/makedumpfile.h b/makedumpfile-1.5.4/makedumpfile.h
index a5826e0..79d4702 100644
--- a/makedumpfile-1.5.4/makedumpfile.h
+++ b/makedumpfile-1.5.4/makedumpfile.h
@@ -1671,6 +1671,41 @@ struct elf_prstatus {
#endif
/*
+ * Below are options which getopt_long can recognize. From OPT_START options are
+ * non-printable, just used for implementation.
+ */
+#define OPT_BLOCK_ORDER 'b'
+#define OPT_COMPRESS_ZLIB 'c'
+#define OPT_DEBUG 'D'
+#define OPT_DUMP_LEVEL 'd'
+#define OPT_ELF_DUMPFILE 'E'
+#define OPT_FLATTEN 'F'
+#define OPT_FORCE 'f'
+#define OPT_GENERATE_VMCOREINFO 'g'
+#define OPT_HELP 'h'
+#define OPT_READ_VMCOREINFO 'i'
+#define OPT_COMPRESS_LZO 'l'
+#define OPT_COMPRESS_SNAPPY 'p'
+#define OPT_REARRANGE 'R'
+#define OPT_VERSION 'v'
+#define OPT_EXCLUDE_XEN_DOM 'X'
+#define OPT_VMLINUX 'x'
+#define OPT_START 256
+#define OPT_SPLIT OPT_START+0
+#define OPT_REASSEMBLE OPT_START+1
+#define OPT_XEN_SYMS OPT_START+2
+#define OPT_XEN_VMCOREINFO OPT_START+3
+#define OPT_XEN_PHYS_START OPT_START+4
+#define OPT_MESSAGE_LEVEL OPT_START+5
+#define OPT_VTOP OPT_START+6
+#define OPT_DUMP_DMESG OPT_START+7
+#define OPT_CONFIG OPT_START+8
+#define OPT_DISKSET OPT_START+9
+#define OPT_NON_CYCLIC OPT_START+10
+#define OPT_CYCLIC_BUFFER OPT_START+11
+#define OPT_EPPIC OPT_START+12
+
+/*
* Function Prototype.
*/
unsigned long long get_num_dumpable_cyclic(void);
--
1.8.4.2

View File

@ -1,38 +0,0 @@
From 7c770ed052d8452f5d7ce027b23d1b77cf6fbce7 Mon Sep 17 00:00:00 2001
From: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
Date: Thu, 12 Dec 2013 16:40:31 +0900
Subject: [PATCH 2/2] [PATCH] Fall back to read() when mmap() fails.
This is a fall back path for mmap().
This patch disables mmap() when facing the issues related to mmap(),
and read() will be used to read vmcore instead.
Signed-off-by: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
---
makedumpfile.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/makedumpfile-1.5.4/makedumpfile.c b/makedumpfile-1.5.4/makedumpfile.c
index b3af28b..20f107e 100644
--- a/makedumpfile-1.5.4/makedumpfile.c
+++ b/makedumpfile-1.5.4/makedumpfile.c
@@ -324,7 +324,15 @@ read_from_vmcore(off_t offset, void *bufptr, unsigned long size)
if (!read_with_mmap(offset, bufptr, size)) {
ERRMSG("Can't read the dump memory(%s) with mmap().\n",
info->name_memory);
- return FALSE;
+
+ ERRMSG("This kernel might have some problems about mmap().\n");
+ ERRMSG("read() will be used instead of mmap() from now.\n");
+
+ /*
+ * Fall back to read().
+ */
+ info->flag_usemmap = MMAP_DISABLE;
+ read_from_vmcore(offset, bufptr, size);
}
} else {
if (lseek(info->fd_memory, offset, SEEK_SET) == failed) {
--
1.8.4.2

View File

@ -1,329 +0,0 @@
From 8e124174b62376b17ac909bc68622ef07bde6840 Mon Sep 17 00:00:00 2001
Message-Id: <8e124174b62376b17ac909bc68622ef07bde6840.1382323707.git.bhe@redhat.com>
From: Jingbai Ma <jingbai.ma@hp.com>
Date: Fri, 18 Oct 2013 18:53:38 +0900
Subject: [PATCH] [PATCH v4] Fix max_mapnr issue on system has over 44-bit
addressing.
This patch will fix a bug of makedumpfile doesn't work correctly on system
has over 44-bit addressing in compression dump mode.
This bug was posted here:
http://lists.infradead.org/pipermail/kexec/2013-September/009587.html
This patch will add 3 new fields in struct kdump_sub_header.
unsigned long long start_pfn_64; /* header_version 6 and later */
unsigned long long end_pfn_64; /* header_version 6 and later */
unsigned long long max_mapnr_64; /* header_version 6 and later */
And the old "unsigned int max_mapnr" in struct disk_dump_header will
not be used anymore, but still be there for compatibility purpose.
The max_mapnr_64 only exists in strcut kdump_sub_header, and that only
for compressed kdump format, so for ELF format kdump files (non-compressed),
only the max_mapnr is available, so it still may be truncated for addresses
exceed 44bit (above 16TB).
This patch will change the header_version to 6.
The corresponding patch for crash utility can be found here:
http://lists.infradead.org/pipermail/kexec/2013-October/009750.html
This patch doesn't change sadump_header.
Changelog:
v4:
- Do not change max_mapnr_64 in kdump_sub_header in memory for old kernel.
v3:
- Change notes for max_mapnr, start_pfn and end_pfn as obsolete.
- Remove "(32bit)" from debug messages of max_mapnr, start_pfn and end_pfn.
- Set the 32bit start_pfn and end_pfn to UINT_MAX.
- Remove bitmap writting enhancement to another seperate patch.
- Change type of len_bitmap in struct DumpInfo back to unsigned long.
v2:
- Rename max_mapnr in struct kdump_sub_header to max_mapnr_64.
- Change type of max_mapnr_64 from unsigned long to unsigned long long.
In x86 PAE mode on x86_32 kernel, the address may exceeds 44bit limit.
- Add start_pfn_64, end_pfn_64 for struct kdump_sub_header.
- Only print 64bit start_pfn_64, end_pfn_64 and max_mapnr_64
debug messages for disk dump header version >= 6.
- Change type of bitmap_len in struct DumpInfo, from unsigned long to
unsigned long long.
- Enhance bitmap writting function in reassemble_kdump_header().
Prevent bitmap writting failure if the size of bitmap is too large to
fit a sigle write.
v1:
- http://lists.infradead.org/pipermail/kexec/2013-September/009662.html
Signed-off-by: Jingbai Ma <jingbai.ma@hp.com>
Tested-by: Lisa Mitchell <lisa.mitchell@hp.com>
---
IMPLEMENTATION | 15 ++++++++++---
diskdump_mod.h | 15 ++++++++++---
makedumpfile.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++------------
3 files changed, 77 insertions(+), 20 deletions(-)
diff --git a/makedumpfile-1.5.4/IMPLEMENTATION b/makedumpfile-1.5.4/IMPLEMENTATION
index f0f3135..2f4cfd6 100644
--- a/makedumpfile-1.5.4/IMPLEMENTATION
+++ b/makedumpfile-1.5.4/IMPLEMENTATION
@@ -48,7 +48,9 @@
header in blocks */
unsigned int bitmap_blocks; /* Size of Memory bitmap in
block */
- unsigned int max_mapnr; /* = max_mapnr */
+ unsigned int max_mapnr; /* = max_mapnr, OBSOLETE!
+ 32bit only, full 64bit
+ in sub header. */
unsigned int total_ram_blocks;/* Number of blocks should be
written */
unsigned int device_blocks; /* Number of total blocks in
@@ -69,14 +71,21 @@
unsigned long phys_base;
int dump_level; /* header_version 1 and later */
int split; /* header_version 2 and later */
- unsigned long start_pfn; /* header_version 2 and later */
- unsigned long end_pfn; /* header_version 2 and later */
+ unsigned long start_pfn; /* header_version 2 and later,
+ OBSOLETE! 32bit only, full
+ 64bit in start_pfn_64. */
+ unsigned long end_pfn; /* header_version 2 and later,
+ OBSOLETE! 32bit only, full
+ 64bit in end_pfn_64. */
off_t offset_vmcoreinfo;/* header_version 3 and later */
unsigned long size_vmcoreinfo; /* header_version 3 and later */
off_t offset_note; /* header_version 4 and later */
unsigned long size_note; /* header_version 4 and later */
off_t offset_eraseinfo; /* header_version 5 and later */
unsigned long size_eraseinfo; /* header_version 5 and later */
+ unsigned long long start_pfn_64; /* header_version 6 and later */
+ unsigned long long end_pfn_64; /* header_version 6 and later */
+ unsigned long long max_mapnr_64; /* header_version 6 and later */
};
- 1st-bitmap
diff --git a/makedumpfile-1.5.4/diskdump_mod.h b/makedumpfile-1.5.4/diskdump_mod.h
index 00ab852..dd24eb2 100644
--- a/makedumpfile-1.5.4/diskdump_mod.h
+++ b/makedumpfile-1.5.4/diskdump_mod.h
@@ -52,7 +52,9 @@ struct disk_dump_header {
header in blocks */
unsigned int bitmap_blocks; /* Size of Memory bitmap in
block */
- unsigned int max_mapnr; /* = max_mapnr */
+ unsigned int max_mapnr; /* = max_mapnr, OBSOLETE!
+ 32bit only, full 64bit
+ in sub header. */
unsigned int total_ram_blocks;/* Number of blocks should be
written */
unsigned int device_blocks; /* Number of total blocks in
@@ -71,14 +73,21 @@ struct kdump_sub_header {
unsigned long phys_base;
int dump_level; /* header_version 1 and later */
int split; /* header_version 2 and later */
- unsigned long start_pfn; /* header_version 2 and later */
- unsigned long end_pfn; /* header_version 2 and later */
+ unsigned long start_pfn; /* header_version 2 and later,
+ OBSOLETE! 32bit only, full
+ 64bit in start_pfn_64. */
+ unsigned long end_pfn; /* header_version 2 and later,
+ OBSOLETE! 32bit only, full
+ 64bit in end_pfn_64. */
off_t offset_vmcoreinfo;/* header_version 3 and later */
unsigned long size_vmcoreinfo; /* header_version 3 and later */
off_t offset_note; /* header_version 4 and later */
unsigned long size_note; /* header_version 4 and later */
off_t offset_eraseinfo; /* header_version 5 and later */
unsigned long size_eraseinfo; /* header_version 5 and later */
+ unsigned long long start_pfn_64; /* header_version 6 and later */
+ unsigned long long end_pfn_64; /* header_version 6 and later */
+ unsigned long long max_mapnr_64; /* header_version 6 and later */
};
/* page flags */
diff --git a/makedumpfile-1.5.4/makedumpfile.c b/makedumpfile-1.5.4/makedumpfile.c
index 9892108..428c53e 100644
--- a/makedumpfile-1.5.4/makedumpfile.c
+++ b/makedumpfile-1.5.4/makedumpfile.c
@@ -23,6 +23,7 @@
#include <stddef.h>
#include <ctype.h>
#include <sys/time.h>
+#include <limits.h>
struct symbol_table symbol_table;
struct size_table size_table;
@@ -125,7 +126,10 @@ get_max_mapnr(void)
unsigned long long max_paddr;
if (info->flag_refiltering) {
- info->max_mapnr = info->dh_memory->max_mapnr;
+ if (info->dh_memory->header_version >= 6)
+ info->max_mapnr = info->kh_memory->max_mapnr_64;
+ else
+ info->max_mapnr = info->dh_memory->max_mapnr;
return TRUE;
}
@@ -802,6 +806,12 @@ get_kdump_compressed_header_info(char *filename)
DEBUG_MSG(" split : %d\n", kh.split);
DEBUG_MSG(" start_pfn : 0x%lx\n", kh.start_pfn);
DEBUG_MSG(" end_pfn : 0x%lx\n", kh.end_pfn);
+ if (dh.header_version >= 6) {
+ /* A dumpfile contains full 64bit values. */
+ DEBUG_MSG(" start_pfn_64 : 0x%llx\n", kh.start_pfn_64);
+ DEBUG_MSG(" end_pfn_64 : 0x%llx\n", kh.end_pfn_64);
+ DEBUG_MSG(" max_mapnr_64 : 0x%llx\n", kh.max_mapnr_64);
+ }
info->dh_memory = malloc(sizeof(dh));
if (info->dh_memory == NULL) {
@@ -2799,14 +2809,16 @@ int
initialize_bitmap_memory(void)
{
struct disk_dump_header *dh;
+ struct kdump_sub_header *kh;
struct dump_bitmap *bmp;
off_t bitmap_offset;
- int bitmap_len, max_sect_len;
+ off_t bitmap_len, max_sect_len;
unsigned long pfn;
int i, j;
long block_size;
dh = info->dh_memory;
+ kh = info->kh_memory;
block_size = dh->block_size;
bitmap_offset
@@ -2826,7 +2838,10 @@ initialize_bitmap_memory(void)
bmp->offset = bitmap_offset + bitmap_len / 2;
info->bitmap_memory = bmp;
- max_sect_len = divideup(dh->max_mapnr, BITMAP_SECT_LEN);
+ if (dh->header_version >= 6)
+ max_sect_len = divideup(kh->max_mapnr_64, BITMAP_SECT_LEN);
+ else
+ max_sect_len = divideup(dh->max_mapnr, BITMAP_SECT_LEN);
info->valid_pages = calloc(sizeof(ulong), max_sect_len);
if (info->valid_pages == NULL) {
ERRMSG("Can't allocate memory for the valid_pages. %s\n",
@@ -4743,7 +4758,7 @@ create_2nd_bitmap(void)
int
prepare_bitmap_buffer(void)
{
- unsigned long tmp;
+ unsigned long long tmp;
/*
* Create 2 bitmaps (1st-bitmap & 2nd-bitmap) on block_size boundary.
@@ -4775,7 +4790,7 @@ prepare_bitmap_buffer(void)
int
prepare_bitmap_buffer_cyclic(void)
{
- unsigned long tmp;
+ unsigned long long tmp;
/*
* Create 2 bitmaps (1st-bitmap & 2nd-bitmap) on block_size boundary.
@@ -5190,11 +5205,12 @@ write_kdump_header(void)
* Write common header
*/
strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE));
- dh->header_version = 5;
+ dh->header_version = 6;
dh->block_size = info->page_size;
dh->sub_hdr_size = sizeof(kh) + size_note;
dh->sub_hdr_size = divideup(dh->sub_hdr_size, dh->block_size);
- dh->max_mapnr = info->max_mapnr;
+ /* dh->max_mapnr may be truncated, full 64bit in kh.max_mapnr_64 */
+ dh->max_mapnr = MIN(info->max_mapnr, UINT_MAX);
dh->nr_cpus = get_nr_cpus();
dh->bitmap_blocks = divideup(info->len_bitmap, dh->block_size);
memcpy(&dh->timestamp, &info->timestamp, sizeof(dh->timestamp));
@@ -5219,12 +5235,22 @@ write_kdump_header(void)
*/
size = sizeof(struct kdump_sub_header);
memset(&kh, 0, size);
+ /* 64bit max_mapnr_64 */
+ kh.max_mapnr_64 = info->max_mapnr;
kh.phys_base = info->phys_base;
kh.dump_level = info->dump_level;
if (info->flag_split) {
kh.split = 1;
- kh.start_pfn = info->split_start_pfn;
- kh.end_pfn = info->split_end_pfn;
+ /*
+ * start_pfn and end_pfn may be truncated,
+ * only for compatibility purpose
+ */
+ kh.start_pfn = MIN(info->split_start_pfn, UINT_MAX);
+ kh.end_pfn = MIN(info->split_end_pfn, UINT_MAX);
+
+ /* 64bit start_pfn_64 and end_pfn_64 */
+ kh.start_pfn_64 = info->split_start_pfn;
+ kh.end_pfn_64 = info->split_end_pfn;
}
if (has_pt_note()) {
/*
@@ -6470,7 +6496,7 @@ int
write_kdump_bitmap(void)
{
struct cache_data bm;
- long buf_size;
+ long long buf_size;
off_t offset;
int ret = FALSE;
@@ -7853,10 +7879,8 @@ store_splitting_info(void)
if (i == 0) {
memcpy(&dh, &tmp_dh, sizeof(tmp_dh));
- info->max_mapnr = dh.max_mapnr;
if (!set_page_size(dh.block_size))
return FALSE;
- DEBUG_MSG("max_mapnr : %llx\n", info->max_mapnr);
DEBUG_MSG("page_size : %ld\n", info->page_size);
}
@@ -7873,11 +7897,24 @@ store_splitting_info(void)
return FALSE;
if (i == 0) {
+ if (dh.header_version >= 6)
+ info->max_mapnr = kh.max_mapnr_64;
+ else
+ info->max_mapnr = dh.max_mapnr;
+
+ DEBUG_MSG("max_mapnr : %llx\n", info->max_mapnr);
+
info->dump_level = kh.dump_level;
DEBUG_MSG("dump_level : %d\n", info->dump_level);
}
- SPLITTING_START_PFN(i) = kh.start_pfn;
- SPLITTING_END_PFN(i) = kh.end_pfn;
+
+ if (dh.header_version >= 6) {
+ SPLITTING_START_PFN(i) = kh.start_pfn_64;
+ SPLITTING_END_PFN(i) = kh.end_pfn_64;
+ } else {
+ SPLITTING_START_PFN(i) = kh.start_pfn;
+ SPLITTING_END_PFN(i) = kh.end_pfn;
+ }
SPLITTING_OFFSET_EI(i) = kh.offset_eraseinfo;
SPLITTING_SIZE_EI(i) = kh.size_eraseinfo;
}
@@ -8039,6 +8076,8 @@ reassemble_kdump_header(void)
kh.split = 0;
kh.start_pfn = 0;
kh.end_pfn = 0;
+ kh.start_pfn_64 = 0;
+ kh.end_pfn_64 = 0;
if (lseek(info->fd_dumpfile, info->page_size, SEEK_SET) < 0) {
ERRMSG("Can't seek a file(%s). %s\n",
--
1.8.3.1

View File

@ -1,200 +0,0 @@
From 20ecc0827e7837c52f3903638a59959f8bf17f9e Mon Sep 17 00:00:00 2001
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Date: Tue, 5 Nov 2013 00:29:35 +0900
Subject: [PATCH] [PATCH v2] Improve progress information for huge memory
system.
On system with huge memory, percentage in progress information is
updated at very slow interval, because 1 percent on 1 TiB memory is
about 10 GiB, which looks like as if system has freezed. Then,
confused users might get tempted to push a reset button to recover the
system. We want to avoid such situation as much as possible.
To address the issue, this patch:
- increases the number of calling print_progress() from once in
(written pages / 100)-pages to once in (written pages /
10000)-pages,
- extends precision in progress information by adding 1 digit to its
fractional part, and
- adds spinner that rotates in the order of /, |, \ and - in next to
the progress indicator in percentage,
which help users to get aware that system is still active and crash
dump process is still in progress now.
The spinner code is borrowed from diskdump code.
The ouput is changed from:
Copying data : [ 0 %] /
Copying data : [ 8 %] |
Copying data : [ 11 %] \
Copying data : [ 14 %] -
Copying data : [ 16 %] /
...
Copying data : [ 99 %] /
Copying data : [100 %] |
to:
Copying data : [ 0.1 %] /
Copying data : [ 8.9 %] |
Copying data : [ 11.6 %] \
Copying data : [ 14.3 %] -
Copying data : [ 16.4 %] /
...
Copying data : [ 99.2 %] /
Copying data : [100.0 %] |
This patch doesn't adopt purely time-based approach that records the
time when print_progress() is called at each invocation and print the
recorded time if it is strictly larger than the previous time value.
The problem is that calling time() system call amounts to
considertably long time in total on huge memory system. For example,
here is a simple bench that measures total execution time of time()
system call for (1TiB / 4KiB)-times:
$ ./bench
total: 18.360503
total: 34.910297
the result of which reveals that it amounts to about 20 seconds with
vDSO optimization and about 35 seconds without.
BTW, on our 12 TiB memory system, we collect about 300 GiB crash dump
in about 40 minutes with dump level 31. On 12TiB, the benchmark result
corresponds to about 4 minutes and 7 minutes respectively, both of which
affects a whole performance.
==bench.c
static inline double getdtime(void)
{
struct timeval tv;
gettimeofday(&tv, NULL);
return (double)tv.tv_sec + (double)tv.tv_usec * 1.0e-6;
}
int main(int argc, char **argv)
{
unsigned long i;
time_t t;
double t1, t2, total;
const int NR_time = 201;
const unsigned long nr_repeat = (1UL << 40) / 4096;
total = 0;
for (i = 0; i < nr_repeat; ++i) {
t1 = getdtime();
time(&t);
t2 = getdtime();
total += t2 - t1;
}
printf("total: %lf\n", total);
total = 0;
for (i = 0; i < nr_repeat; ++i) {
t1 = getdtime();
syscall(NR_time, &t);
t2 = getdtime();
total += t2 - t1;
}
printf("total: %lf\n", total);
return 0;
}
==
Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
---
makedumpfile.c | 8 ++++----
print_info.c | 15 +++++++++------
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/makedumpfile-1.5.4/makedumpfile.c b/makedumpfile-1.5.4/makedumpfile.c
index dafe83b..3746cf6 100644
--- a/makedumpfile-1.5.4/makedumpfile.c
+++ b/makedumpfile-1.5.4/makedumpfile.c
@@ -5573,7 +5573,7 @@ write_elf_pages(struct cache_data *cd_header, struct cache_data *cd_page)
initialize_2nd_bitmap(&bitmap2);
num_dumpable = get_num_dumpable();
- per = num_dumpable / 100;
+ per = num_dumpable / 10000;
off_seg_load = info->offset_load_dumpfile;
cd_page->offset = info->offset_load_dumpfile;
@@ -5858,7 +5858,7 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page)
return FALSE;
num_dumpable = info->num_dumpable;
- per = num_dumpable / 100;
+ per = num_dumpable / 10000;
off_seg_load = info->offset_load_dumpfile;
cd_page->offset = info->offset_load_dumpfile;
@@ -6116,7 +6116,7 @@ write_kdump_pages(struct cache_data *cd_header, struct cache_data *cd_page)
}
num_dumpable = get_num_dumpable();
- per = num_dumpable / 100;
+ per = num_dumpable / 10000;
/*
* Calculate the offset of the page data.
@@ -6317,7 +6317,7 @@ write_kdump_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_pag
goto out;
}
- per = info->num_dumpable / 100;
+ per = info->num_dumpable / 10000;
/*
* Set a fileoffset of Physical Address 0x0.
diff --git a/makedumpfile-1.5.4/print_info.c b/makedumpfile-1.5.4/print_info.c
index 3527970..d7a8600 100644
--- a/makedumpfile-1.5.4/print_info.c
+++ b/makedumpfile-1.5.4/print_info.c
@@ -283,27 +283,30 @@ print_usage(void)
void
print_progress(const char *msg, unsigned long current, unsigned long end)
{
- int progress;
+ float progress;
time_t tm;
static time_t last_time = 0;
+ static unsigned int lapse = 0;
+ static const char *spinner = "/|\\-";
if (current < end) {
tm = time(NULL);
if (tm - last_time < 1)
return;
last_time = tm;
- progress = current * 100 / end;
+ progress = (float)current * 100 / end;
} else
progress = 100;
if (flag_ignore_r_char) {
- PROGRESS_MSG("%-" PROGRESS_MAXLEN "s: [%3d %%]\n",
- msg, progress);
+ PROGRESS_MSG("%-" PROGRESS_MAXLEN "s: [%5.1f %%] %c\n",
+ msg, progress, spinner[lapse % 4]);
} else {
PROGRESS_MSG("\r");
- PROGRESS_MSG("%-" PROGRESS_MAXLEN "s: [%3d %%] ",
- msg, progress);
+ PROGRESS_MSG("%-" PROGRESS_MAXLEN "s: [%5.1f %%] %c",
+ msg, progress, spinner[lapse % 4]);
}
+ lapse++;
}
void
--
1.8.3.1

View File

@ -1,47 +0,0 @@
From 1202589997ad008b18276f504c5c2b8529b41dfe Mon Sep 17 00:00:00 2001
Message-Id: <1202589997ad008b18276f504c5c2b8529b41dfe.1380186577.git.bhe@redhat.com>
From: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
Date: Fri, 20 Sep 2013 09:34:57 +0900
Subject: [PATCH] [PATCH] Support newer kernels.
A new makedumpfile supports newer kernels:
- 3.10 (x86 FLATMEM)
- 3.10 (x86 SPARSEMEM)
- 3.10 (x86_64 SPARSEMEM)
Signed-off-by: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
Signed-off-by: Baoquan He <bhe@redhat.com>
---
README | 1 +
makedumpfile.h | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/makedumpfile-1.5.4/README b/makedumpfile-1.5.4/README
index b587485..4e838d8 100644
--- a/makedumpfile-1.5.4/README
+++ b/makedumpfile-1.5.4/README
@@ -97,6 +97,7 @@
3.7 | OK | ** | | | | ** | | -- | OK | OK | | |
3.8 | OK | ** | | | | ** | | -- | OK | OK | | |
3.9 | OK | ** | | | | ** | | -- | OK | OK | | |
+ 3.10 | OK | ** | | | | ** | | -- | OK | OK | | |
OK : Support.
-- : Not support.
diff --git a/makedumpfile-1.5.4/makedumpfile.h b/makedumpfile-1.5.4/makedumpfile.h
index a04154e..c504bfb 100644
--- a/makedumpfile-1.5.4/makedumpfile.h
+++ b/makedumpfile-1.5.4/makedumpfile.h
@@ -426,7 +426,7 @@ do { \
#define KVER_MIN_SHIFT 16
#define KERNEL_VERSION(x,y,z) (((x) << KVER_MAJ_SHIFT) | ((y) << KVER_MIN_SHIFT) | (z))
#define OLDEST_VERSION KERNEL_VERSION(2, 6, 15)/* linux-2.6.15 */
-#define LATEST_VERSION KERNEL_VERSION(3, 9, 6)/* linux-3.9.6 */
+#define LATEST_VERSION KERNEL_VERSION(3, 10, 7)/* linux-3.10.7 */
/*
* vmcoreinfo in /proc/vmcore
--
1.8.3.1

View File

@ -1,429 +0,0 @@
From bcdba922182def3dac288ca201e77e7738a1e4ab Mon Sep 17 00:00:00 2001
From: Hari Bathini <hbathini@linux.vnet.ibm.com>
Date: Mon, 25 Nov 2013 17:20:55 +0900
Subject: [PATCH] [PATCH v5] Support to filter dump for kernels that use
CONFIG_SPARSEMEM_VMEMMAP.
Makedumpfile tool fails to filter dump for kernels that are build with
CONFIG_SPARSEMEM_VMEMMAP set, as it fails to do address translations
for vmemmap regions that are mapped out of zone normal. This patch
provides support in makedumpfile to do vmemmap to physical address
translations when they are mapped outside zone normal. Some kernel
symbols are needed in vmcoreinfo for this changes to be effective.
The kernel patch that adds the necessary symbols to vmcoreinfo has
been posted to linuxppc devel mailing list. This patch is influenced
by vmemmap to physical address translation support code in crash tool.
This patch has been tested successfully at all dump filtering levels
on kernels with CONFIG_SPARSEMEM_VMEMMAP set/unset. Also, tested dump
filtering on already filtered vmcores (re-filtering).
Changes from v4 to v5:
Trimmed patch description to be compact and readable.
Changes from v3 to v4:
Rebased to devel branch.
Signed-off-by: Onkar N Mahajan <onmahaja@in.ibm.com>
Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
---
arch/ppc64.c | 175 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
makedumpfile.c | 39 +++++++++++++
makedumpfile.h | 37 ++++++++++++
3 files changed, 247 insertions(+), 4 deletions(-)
diff --git a/makedumpfile-1.5.4/arch/ppc64.c b/makedumpfile-1.5.4/arch/ppc64.c
index 85144f6..09c0eb3 100644
--- a/makedumpfile-1.5.4/arch/ppc64.c
+++ b/makedumpfile-1.5.4/arch/ppc64.c
@@ -24,6 +24,154 @@
#include "../elf_info.h"
#include "../makedumpfile.h"
+/*
+ * This function traverses vmemmap list to get the count of vmemmap regions
+ * and populates the regions' info in info->vmemmap_list[]
+ */
+static int
+get_vmemmap_list_info(ulong head)
+{
+ int i, cnt;
+ long backing_size, virt_addr_offset, phys_offset, list_offset;
+ ulong curr, next;
+ char *vmemmap_buf = NULL;
+
+ backing_size = SIZE(vmemmap_backing);
+ virt_addr_offset = OFFSET(vmemmap_backing.virt_addr);
+ phys_offset = OFFSET(vmemmap_backing.phys);
+ list_offset = OFFSET(vmemmap_backing.list);
+ info->vmemmap_list = NULL;
+
+ /*
+ * Get list count by traversing the vmemmap list
+ */
+ cnt = 0;
+ curr = head;
+ next = 0;
+ do {
+ if (!readmem(VADDR, (curr + list_offset), &next,
+ sizeof(next))) {
+ ERRMSG("Can't get vmemmap region addresses\n");
+ goto err;
+ }
+ curr = next;
+ cnt++;
+ } while ((next != 0) && (next != head));
+
+ /*
+ * Using temporary buffer to save vmemmap region information
+ */
+ vmemmap_buf = calloc(1, backing_size);
+ if (vmemmap_buf == NULL) {
+ ERRMSG("Can't allocate memory for vmemmap_buf. %s\n",
+ strerror(errno));
+ goto err;
+ }
+
+ info->vmemmap_list = calloc(1, cnt * sizeof(struct ppc64_vmemmap));
+ if (info->vmemmap_list == NULL) {
+ ERRMSG("Can't allocate memory for vmemmap_list. %s\n",
+ strerror(errno));
+ goto err;
+ }
+
+ curr = head;
+ for (i = 0; i < cnt; i++) {
+ if (!readmem(VADDR, curr, vmemmap_buf, backing_size)) {
+ ERRMSG("Can't get vmemmap region info\n");
+ goto err;
+ }
+
+ info->vmemmap_list[i].phys = ULONG(vmemmap_buf + phys_offset);
+ info->vmemmap_list[i].virt = ULONG(vmemmap_buf +
+ virt_addr_offset);
+ curr = ULONG(vmemmap_buf + list_offset);
+
+ if (info->vmemmap_list[i].virt < info->vmemmap_start)
+ info->vmemmap_start = info->vmemmap_list[i].virt;
+
+ if ((info->vmemmap_list[i].virt + info->vmemmap_psize) >
+ info->vmemmap_end)
+ info->vmemmap_end = (info->vmemmap_list[i].virt +
+ info->vmemmap_psize);
+ }
+
+ free(vmemmap_buf);
+ return cnt;
+err:
+ free(vmemmap_buf);
+ free(info->vmemmap_list);
+ return 0;
+}
+
+/*
+ * Verify that the kernel has made the vmemmap list available,
+ * and if so, stash the relevant data required to make vtop
+ * translations.
+ */
+static int
+ppc64_vmemmap_init(void)
+{
+ int psize, shift;
+ ulong head;
+
+ if ((SYMBOL(vmemmap_list) == NOT_FOUND_SYMBOL)
+ || (SYMBOL(mmu_psize_defs) == NOT_FOUND_SYMBOL)
+ || (SYMBOL(mmu_vmemmap_psize) == NOT_FOUND_SYMBOL)
+ || (SIZE(vmemmap_backing) == NOT_FOUND_STRUCTURE)
+ || (SIZE(mmu_psize_def) == NOT_FOUND_STRUCTURE)
+ || (OFFSET(mmu_psize_def.shift) == NOT_FOUND_STRUCTURE)
+ || (OFFSET(vmemmap_backing.phys) == NOT_FOUND_STRUCTURE)
+ || (OFFSET(vmemmap_backing.virt_addr) == NOT_FOUND_STRUCTURE)
+ || (OFFSET(vmemmap_backing.list) == NOT_FOUND_STRUCTURE))
+ return FALSE;
+
+ if (!readmem(VADDR, SYMBOL(mmu_vmemmap_psize), &psize, sizeof(int)))
+ return FALSE;
+
+ if (!readmem(VADDR, SYMBOL(mmu_psize_defs) +
+ (SIZE(mmu_psize_def) * psize) +
+ OFFSET(mmu_psize_def.shift), &shift, sizeof(int)))
+ return FALSE;
+ info->vmemmap_psize = 1 << shift;
+
+ if (!readmem(VADDR, SYMBOL(vmemmap_list), &head, sizeof(unsigned long)))
+ return FALSE;
+
+ /*
+ * Get vmemmap list count and populate vmemmap regions info
+ */
+ info->vmemmap_cnt = get_vmemmap_list_info(head);
+ if (info->vmemmap_cnt == 0)
+ return FALSE;
+
+ info->flag_vmemmap = TRUE;
+ return TRUE;
+}
+
+/*
+ * If the vmemmap address translation information is stored in the kernel,
+ * make the translation.
+ */
+static unsigned long long
+ppc64_vmemmap_to_phys(unsigned long vaddr)
+{
+ int i;
+ ulong offset;
+ unsigned long long paddr = NOT_PADDR;
+
+ for (i = 0; i < info->vmemmap_cnt; i++) {
+ if ((vaddr >= info->vmemmap_list[i].virt) && (vaddr <
+ (info->vmemmap_list[i].virt + info->vmemmap_psize))) {
+ offset = vaddr - info->vmemmap_list[i].virt;
+ paddr = info->vmemmap_list[i].phys + offset;
+ break;
+ }
+ }
+
+ return paddr;
+}
+
int
set_ppc64_max_physmem_bits(void)
{
@@ -103,6 +251,16 @@ get_machdep_info_ppc64(void)
info->vmalloc_start = vmalloc_start;
DEBUG_MSG("vmalloc_start: %lx\n", vmalloc_start);
+ if (SYMBOL(vmemmap_list) != NOT_FOUND_SYMBOL) {
+ info->vmemmap_start = VMEMMAP_REGION_ID << REGION_SHIFT;
+ info->vmemmap_end = info->vmemmap_start;
+ if (ppc64_vmemmap_init() == FALSE) {
+ ERRMSG("Can't get vmemmap list info.\n");
+ return FALSE;
+ }
+ DEBUG_MSG("vmemmap_start: %lx\n", info->vmemmap_start);
+ }
+
return TRUE;
}
@@ -121,14 +279,23 @@ vaddr_to_paddr_ppc64(unsigned long vaddr)
if (paddr != NOT_PADDR)
return paddr;
- if ((SYMBOL(vmlist) == NOT_FOUND_SYMBOL)
- || (OFFSET(vm_struct.addr) == NOT_FOUND_STRUCTURE)) {
- ERRMSG("Can't get necessary information for vmalloc translation.\n");
- return NOT_PADDR;
+ if ((SYMBOL(vmap_area_list) == NOT_FOUND_SYMBOL)
+ || (OFFSET(vmap_area.va_start) == NOT_FOUND_STRUCTURE)
+ || (OFFSET(vmap_area.list) == NOT_FOUND_STRUCTURE)) {
+ if ((SYMBOL(vmlist) == NOT_FOUND_SYMBOL)
+ || (OFFSET(vm_struct.addr) == NOT_FOUND_STRUCTURE)) {
+ ERRMSG("Can't get info for vmalloc translation.\n");
+ return NOT_PADDR;
+ }
}
if (!is_vmalloc_addr_ppc64(vaddr))
return (vaddr - info->kernel_start);
+ if ((info->flag_vmemmap)
+ && (vaddr >= info->vmemmap_start)) {
+ return ppc64_vmemmap_to_phys(vaddr);
+ }
+
/*
* TODO: Support vmalloc translation.
*/
diff --git a/makedumpfile-1.5.4/makedumpfile.c b/makedumpfile-1.5.4/makedumpfile.c
index 3746cf6..0c68f32 100644
--- a/makedumpfile-1.5.4/makedumpfile.c
+++ b/makedumpfile-1.5.4/makedumpfile.c
@@ -1107,6 +1107,10 @@ get_symbol_info(void)
SYMBOL_ARRAY_LENGTH_INIT(node_remap_start_pfn,
"node_remap_start_pfn");
+ SYMBOL_INIT(vmemmap_list, "vmemmap_list");
+ SYMBOL_INIT(mmu_psize_defs, "mmu_psize_defs");
+ SYMBOL_INIT(mmu_vmemmap_psize, "mmu_vmemmap_psize");
+
return TRUE;
}
@@ -1417,6 +1421,20 @@ get_structure_info(void)
OFFSET_INIT(printk_log.text_len, "log", "text_len");
}
+ /*
+ * Get offsets of the vmemmap_backing's members.
+ */
+ SIZE_INIT(vmemmap_backing, "vmemmap_backing");
+ OFFSET_INIT(vmemmap_backing.phys, "vmemmap_backing", "phys");
+ OFFSET_INIT(vmemmap_backing.virt_addr, "vmemmap_backing", "virt_addr");
+ OFFSET_INIT(vmemmap_backing.list, "vmemmap_backing", "list");
+
+ /*
+ * Get offsets of the mmu_psize_def's members.
+ */
+ SIZE_INIT(mmu_psize_def, "mmu_psize_def");
+ OFFSET_INIT(mmu_psize_def.shift, "mmu_psize_def", "shift");
+
return TRUE;
}
@@ -1603,6 +1621,9 @@ write_vmcoreinfo_data(void)
WRITE_SYMBOL("node_remap_start_vaddr", node_remap_start_vaddr);
WRITE_SYMBOL("node_remap_end_vaddr", node_remap_end_vaddr);
WRITE_SYMBOL("node_remap_start_pfn", node_remap_start_pfn);
+ WRITE_SYMBOL("vmemmap_list", vmemmap_list);
+ WRITE_SYMBOL("mmu_psize_defs", mmu_psize_defs);
+ WRITE_SYMBOL("mmu_vmemmap_psize", mmu_vmemmap_psize);
/*
* write the structure size of 1st kernel
@@ -1620,6 +1641,8 @@ write_vmcoreinfo_data(void)
WRITE_STRUCTURE_SIZE("printk_log", printk_log);
else
WRITE_STRUCTURE_SIZE("log", printk_log);
+ WRITE_STRUCTURE_SIZE("vmemmap_backing", vmemmap_backing);
+ WRITE_STRUCTURE_SIZE("mmu_psize_def", mmu_psize_def);
/*
* write the member offset of 1st kernel
@@ -1664,6 +1687,11 @@ write_vmcoreinfo_data(void)
WRITE_MEMBER_OFFSET("log.len", printk_log.len);
WRITE_MEMBER_OFFSET("log.text_len", printk_log.text_len);
}
+ WRITE_MEMBER_OFFSET("vmemmap_backing.phys", vmemmap_backing.phys);
+ WRITE_MEMBER_OFFSET("vmemmap_backing.virt_addr",
+ vmemmap_backing.virt_addr);
+ WRITE_MEMBER_OFFSET("vmemmap_backing.list", vmemmap_backing.list);
+ WRITE_MEMBER_OFFSET("mmu_psize_def.shift", mmu_psize_def.shift);
if (SYMBOL(node_data) != NOT_FOUND_SYMBOL)
WRITE_ARRAY_LENGTH("node_data", node_data);
@@ -1932,6 +1960,9 @@ read_vmcoreinfo(void)
READ_SYMBOL("node_remap_start_vaddr", node_remap_start_vaddr);
READ_SYMBOL("node_remap_end_vaddr", node_remap_end_vaddr);
READ_SYMBOL("node_remap_start_pfn", node_remap_start_pfn);
+ READ_SYMBOL("vmemmap_list", vmemmap_list);
+ READ_SYMBOL("mmu_psize_defs", mmu_psize_defs);
+ READ_SYMBOL("mmu_vmemmap_psize", mmu_vmemmap_psize);
READ_STRUCTURE_SIZE("page", page);
READ_STRUCTURE_SIZE("mem_section", mem_section);
@@ -1942,6 +1973,9 @@ read_vmcoreinfo(void)
READ_STRUCTURE_SIZE("node_memblk_s", node_memblk_s);
READ_STRUCTURE_SIZE("nodemask_t", nodemask_t);
READ_STRUCTURE_SIZE("pageflags", pageflags);
+ READ_STRUCTURE_SIZE("vmemmap_backing", vmemmap_backing);
+ READ_STRUCTURE_SIZE("mmu_psize_def", mmu_psize_def);
+
READ_MEMBER_OFFSET("page.flags", page.flags);
READ_MEMBER_OFFSET("page._count", page._count);
@@ -1972,6 +2006,11 @@ read_vmcoreinfo(void)
READ_MEMBER_OFFSET("vm_struct.addr", vm_struct.addr);
READ_MEMBER_OFFSET("vmap_area.va_start", vmap_area.va_start);
READ_MEMBER_OFFSET("vmap_area.list", vmap_area.list);
+ READ_MEMBER_OFFSET("vmemmap_backing.phys", vmemmap_backing.phys);
+ READ_MEMBER_OFFSET("vmemmap_backing.virt_addr",
+ vmemmap_backing.virt_addr);
+ READ_MEMBER_OFFSET("vmemmap_backing.list", vmemmap_backing.list);
+ READ_MEMBER_OFFSET("mmu_psize_def.shift", mmu_psize_def.shift);
READ_STRUCTURE_SIZE("printk_log", printk_log);
if (SIZE(printk_log) != NOT_FOUND_STRUCTURE) {
diff --git a/makedumpfile-1.5.4/makedumpfile.h b/makedumpfile-1.5.4/makedumpfile.h
index 3a7e61a..517e16e 100644
--- a/makedumpfile-1.5.4/makedumpfile.h
+++ b/makedumpfile-1.5.4/makedumpfile.h
@@ -576,6 +576,8 @@ do { \
#define _SECTION_SIZE_BITS (24)
#define _MAX_PHYSMEM_BITS_ORIG (44)
#define _MAX_PHYSMEM_BITS_3_7 (46)
+#define REGION_SHIFT (60UL)
+#define VMEMMAP_REGION_ID (0xfUL)
#endif
#ifdef __powerpc32__
@@ -862,6 +864,11 @@ struct splitting_info {
unsigned long size_eraseinfo;
} splitting_info_t;
+struct ppc64_vmemmap {
+ unsigned long phys;
+ unsigned long virt;
+};
+
struct DumpInfo {
int32_t kernel_version; /* version of first kernel*/
struct timeval timestamp;
@@ -895,6 +902,7 @@ struct DumpInfo {
int flag_dmesg; /* dump the dmesg log out of the vmcore file */
int flag_use_printk_log; /* did we read printk_log symbol name? */
int flag_nospace; /* the flag of "No space on device" error */
+ int flag_vmemmap; /* kernel supports vmemmap address space */
unsigned long vaddr_for_vtop; /* virtual address for debugging */
long page_size; /* size of page */
long page_shift;
@@ -909,6 +917,9 @@ struct DumpInfo {
unsigned long vmalloc_end;
unsigned long vmemmap_start;
unsigned long vmemmap_end;
+ int vmemmap_psize;
+ int vmemmap_cnt;
+ struct ppc64_vmemmap *vmemmap_list;
/*
* Filter config file containing filter commands to filter out kernel
@@ -1166,6 +1177,13 @@ struct symbol_table {
unsigned long long __per_cpu_load;
unsigned long long cpu_online_mask;
unsigned long long kexec_crash_image;
+
+ /*
+ * vmemmap symbols on ppc64 arch
+ */
+ unsigned long long vmemmap_list;
+ unsigned long long mmu_vmemmap_psize;
+ unsigned long long mmu_psize_defs;
};
struct size_table {
@@ -1201,6 +1219,12 @@ struct size_table {
long kexec_segment;
long elf64_hdr;
+ /*
+ * vmemmap symbols on ppc64 arch
+ */
+ long vmemmap_backing;
+ long mmu_psize_def;
+
long pageflags;
};
@@ -1344,6 +1368,19 @@ struct offset_table {
long text_len;
} printk_log;
+ /*
+ * vmemmap symbols on ppc64 arch
+ */
+ struct mmu_psize_def {
+ long shift;
+ } mmu_psize_def;
+
+ struct vmemmap_backing {
+ long phys;
+ long virt_addr;
+ long list;
+ } vmemmap_backing;
+
};
/*
--
1.8.3.1

View File

@ -1,197 +0,0 @@
From a01b663749c4b221ecd03285fa24a4b31e742004 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Fri, 20 Sep 2013 15:56:49 +0900
Subject: [PATCH] [PATCH v2] dump-dmesg: Understand >= v3.11-rc4 dmesg.
Symbol name changed with the following commit:
62e32ac printk: rename struct log to struct printk_log
Changes for v2:
* Only back values for symbol names we did actually read;
either "log" or "printk_log"
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
makedumpfile.c | 69 +++++++++++++++++++++++++++++++++++++++++++---------------
makedumpfile.h | 7 +++---
2 files changed, 55 insertions(+), 21 deletions(-)
diff --git a/makedumpfile-1.5.4/makedumpfile.c b/makedumpfile-1.5.4/makedumpfile.c
index e01ff50..7bbdcc2 100644
--- a/makedumpfile-1.5.4/makedumpfile.c
+++ b/makedumpfile-1.5.4/makedumpfile.c
@@ -1389,10 +1389,23 @@ get_structure_info(void)
OFFSET_INIT(elf64_phdr.p_paddr, "elf64_phdr", "p_paddr");
OFFSET_INIT(elf64_phdr.p_memsz, "elf64_phdr", "p_memsz");
- SIZE_INIT(log, "log");
- OFFSET_INIT(log.ts_nsec, "log", "ts_nsec");
- OFFSET_INIT(log.len, "log", "len");
- OFFSET_INIT(log.text_len, "log", "text_len");
+ SIZE_INIT(printk_log, "printk_log");
+ if (SIZE(printk_log) != NOT_FOUND_STRUCTURE) {
+ /*
+ * In kernel 3.11-rc4 the log structure name was renamed
+ * to "printk_log".
+ */
+ info->flag_use_printk_log = TRUE;
+ OFFSET_INIT(printk_log.ts_nsec, "printk_log", "ts_nsec");
+ OFFSET_INIT(printk_log.len, "printk_log", "len");
+ OFFSET_INIT(printk_log.text_len, "printk_log", "text_len");
+ } else {
+ info->flag_use_printk_log = FALSE;
+ SIZE_INIT(printk_log, "log");
+ OFFSET_INIT(printk_log.ts_nsec, "log", "ts_nsec");
+ OFFSET_INIT(printk_log.len, "log", "len");
+ OFFSET_INIT(printk_log.text_len, "log", "text_len");
+ }
return TRUE;
}
@@ -1593,7 +1606,10 @@ write_vmcoreinfo_data(void)
WRITE_STRUCTURE_SIZE("node_memblk_s", node_memblk_s);
WRITE_STRUCTURE_SIZE("nodemask_t", nodemask_t);
WRITE_STRUCTURE_SIZE("pageflags", pageflags);
- WRITE_STRUCTURE_SIZE("log", log);
+ if (info->flag_use_printk_log)
+ WRITE_STRUCTURE_SIZE("printk_log", printk_log);
+ else
+ WRITE_STRUCTURE_SIZE("log", printk_log);
/*
* write the member offset of 1st kernel
@@ -1628,9 +1644,16 @@ write_vmcoreinfo_data(void)
WRITE_MEMBER_OFFSET("vm_struct.addr", vm_struct.addr);
WRITE_MEMBER_OFFSET("vmap_area.va_start", vmap_area.va_start);
WRITE_MEMBER_OFFSET("vmap_area.list", vmap_area.list);
- WRITE_MEMBER_OFFSET("log.ts_nsec", log.ts_nsec);
- WRITE_MEMBER_OFFSET("log.len", log.len);
- WRITE_MEMBER_OFFSET("log.text_len", log.text_len);
+ if (info->flag_use_printk_log) {
+ WRITE_MEMBER_OFFSET("printk_log.ts_nsec", printk_log.ts_nsec);
+ WRITE_MEMBER_OFFSET("printk_log.len", printk_log.len);
+ WRITE_MEMBER_OFFSET("printk_log.text_len", printk_log.text_len);
+ } else {
+ /* Compatibility with pre-3.11-rc4 */
+ WRITE_MEMBER_OFFSET("log.ts_nsec", printk_log.ts_nsec);
+ WRITE_MEMBER_OFFSET("log.len", printk_log.len);
+ WRITE_MEMBER_OFFSET("log.text_len", printk_log.text_len);
+ }
if (SYMBOL(node_data) != NOT_FOUND_SYMBOL)
WRITE_ARRAY_LENGTH("node_data", node_data);
@@ -1909,7 +1932,6 @@ read_vmcoreinfo(void)
READ_STRUCTURE_SIZE("node_memblk_s", node_memblk_s);
READ_STRUCTURE_SIZE("nodemask_t", nodemask_t);
READ_STRUCTURE_SIZE("pageflags", pageflags);
- READ_STRUCTURE_SIZE("log", log);
READ_MEMBER_OFFSET("page.flags", page.flags);
READ_MEMBER_OFFSET("page._count", page._count);
@@ -1940,9 +1962,20 @@ read_vmcoreinfo(void)
READ_MEMBER_OFFSET("vm_struct.addr", vm_struct.addr);
READ_MEMBER_OFFSET("vmap_area.va_start", vmap_area.va_start);
READ_MEMBER_OFFSET("vmap_area.list", vmap_area.list);
- READ_MEMBER_OFFSET("log.ts_nsec", log.ts_nsec);
- READ_MEMBER_OFFSET("log.len", log.len);
- READ_MEMBER_OFFSET("log.text_len", log.text_len);
+
+ READ_STRUCTURE_SIZE("printk_log", printk_log);
+ if (SIZE(printk_log) != NOT_FOUND_STRUCTURE) {
+ info->flag_use_printk_log = TRUE;
+ READ_MEMBER_OFFSET("printk_log.ts_nsec", printk_log.ts_nsec);
+ READ_MEMBER_OFFSET("printk_log.len", printk_log.len);
+ READ_MEMBER_OFFSET("printk_log.text_len", printk_log.text_len);
+ } else {
+ info->flag_use_printk_log = FALSE;
+ READ_STRUCTURE_SIZE("log", printk_log);
+ READ_MEMBER_OFFSET("log.ts_nsec", printk_log.ts_nsec);
+ READ_MEMBER_OFFSET("log.len", printk_log.len);
+ READ_MEMBER_OFFSET("log.text_len", printk_log.text_len);
+ }
READ_ARRAY_LENGTH("node_data", node_data);
READ_ARRAY_LENGTH("pgdat_list", pgdat_list);
@@ -3710,13 +3743,13 @@ dump_log_entry(char *logptr, int fp)
ulonglong nanos;
ulong rem;
- text_len = USHORT(logptr + OFFSET(log.text_len));
- ts_nsec = ULONGLONG(logptr + OFFSET(log.ts_nsec));
+ text_len = USHORT(logptr + OFFSET(printk_log.text_len));
+ ts_nsec = ULONGLONG(logptr + OFFSET(printk_log.ts_nsec));
nanos = (ulonglong)ts_nsec / (ulonglong)1000000000;
rem = (ulonglong)ts_nsec % (ulonglong)1000000000;
- msg = logptr + SIZE(log);
+ msg = logptr + SIZE(printk_log);
sprintf(buf, "[%5lld.%06ld] ", nanos, rem/1000);
@@ -3754,7 +3787,7 @@ log_from_idx(unsigned int idx, char *logbuf)
* the buffer.
*/
- msglen = USHORT(logptr + OFFSET(log.len));
+ msglen = USHORT(logptr + OFFSET(printk_log.len));
if (!msglen)
logptr = logbuf;
@@ -3775,9 +3808,9 @@ log_next(unsigned int idx, char *logbuf)
* return the one after that.
*/
- msglen = USHORT(logptr + OFFSET(log.len));
+ msglen = USHORT(logptr + OFFSET(printk_log.len));
if (!msglen) {
- msglen = USHORT(logbuf + OFFSET(log.len));
+ msglen = USHORT(logbuf + OFFSET(printk_log.len));
return msglen;
}
diff --git a/makedumpfile-1.5.4/makedumpfile.h b/makedumpfile-1.5.4/makedumpfile.h
index c504bfb..3a7e61a 100644
--- a/makedumpfile-1.5.4/makedumpfile.h
+++ b/makedumpfile-1.5.4/makedumpfile.h
@@ -893,6 +893,7 @@ struct DumpInfo {
int flag_force; /* overwrite existing stuff */
int flag_exclude_xen_dom;/* exclude Domain-U from xen-kdump */
int flag_dmesg; /* dump the dmesg log out of the vmcore file */
+ int flag_use_printk_log; /* did we read printk_log symbol name? */
int flag_nospace; /* the flag of "No space on device" error */
unsigned long vaddr_for_vtop; /* virtual address for debugging */
long page_size; /* size of page */
@@ -1176,6 +1177,7 @@ struct size_table {
long list_head;
long node_memblk_s;
long nodemask_t;
+ long printk_log;
/*
* for Xen extraction
@@ -1198,7 +1200,6 @@ struct size_table {
long cpumask_t;
long kexec_segment;
long elf64_hdr;
- long log;
long pageflags;
};
@@ -1337,11 +1338,11 @@ struct offset_table {
long p_memsz;
} elf64_phdr;
- struct log_s {
+ struct printk_log_s {
long ts_nsec;
long len;
long text_len;
- } log;
+ } printk_log;
};
--
1.8.3.1

View File

@ -1,33 +0,0 @@
From a785fa7dd7a7bd7dcbb017d0bea8848243b0924f Mon Sep 17 00:00:00 2001
Message-Id: <a785fa7dd7a7bd7dcbb017d0bea8848243b0924f.1382423400.git.bhe@redhat.com>
From: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
Date: Thu, 12 Sep 2013 08:31:28 +0900
Subject: [PATCH 1/2] [PATCH] Update pfn_cyclic when the cyclic buffer size is
corrected.
When the clearing bit operation for excluding free pages can overrun
the cyclic buffer, the buffer size is changed with
check_cyclic_buffer_overrun().
Then pfn_cyclic should be recalculated.
Reviewed-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Signed-off-by: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
---
makedumpfile.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/makedumpfile-1.5.4/makedumpfile.c b/makedumpfile-1.5.4/makedumpfile.c
index 09c0d4a..164b3f1 100644
--- a/makedumpfile-1.5.4/makedumpfile.c
+++ b/makedumpfile-1.5.4/makedumpfile.c
@@ -4091,6 +4091,7 @@ check_cyclic_buffer_overrun(void)
bufsize = info->bufsize_cyclic;
info->bufsize_cyclic = round(bufsize, max_block_size);
+ info->pfn_cyclic = info->bufsize_cyclic * BITPERBYTE;
MSG("cyclic buffer size has been changed: %lu => %lu\n",
bufsize, info->bufsize_cyclic);
--
1.8.3.1

View File

@ -1,44 +0,0 @@
From f8c8218856effc43ea01cd9394761cfb8aeaa8df Mon Sep 17 00:00:00 2001
Message-Id: <f8c8218856effc43ea01cd9394761cfb8aeaa8df.1382423400.git.bhe@redhat.com>
In-Reply-To: <a785fa7dd7a7bd7dcbb017d0bea8848243b0924f.1382423400.git.bhe@redhat.com>
References: <a785fa7dd7a7bd7dcbb017d0bea8848243b0924f.1382423400.git.bhe@redhat.com>
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Date: Thu, 12 Sep 2013 13:19:00 +0900
Subject: [PATCH 2/2] [PATCH] Use divideup() to calculate maximum required
bitmap size.
Currently, check_cyclic_buffer_overrun() wrongly calculates maximum
bitmap size required to represent maximum block size managed by buddy
allocator with roundup(). Then, max_block_size is BITPERBYTE-time
larger than its correct size. As a result, although the bug never
affect free-page filtering since roundup(max_order_nr_pages,
BITPERBYTE) is a multiple of divideup(max_order_nr_pages, BITPERBYTE),
the following sanity check, (max_block_size > info->bufsize_cyclic),
and recalculation of info->bufsize_cyclic becomes BITPERBYTE-time
conservative and inefficient.
Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
---
makedumpfile.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/makedumpfile-1.5.4/makedumpfile.c b/makedumpfile-1.5.4/makedumpfile.c
index 164b3f1..1718f88 100644
--- a/makedumpfile-1.5.4/makedumpfile.c
+++ b/makedumpfile-1.5.4/makedumpfile.c
@@ -4078,10 +4078,9 @@ check_cyclic_buffer_overrun(void)
{
int max_order = ARRAY_LENGTH(zone.free_area);
int max_order_nr_pages = 1 << (max_order - 1);
- unsigned long max_block_size = roundup(max_order_nr_pages, BITPERBYTE);
+ unsigned long max_block_size = divideup(max_order_nr_pages, BITPERBYTE);
- if (info->bufsize_cyclic %
- roundup(max_order_nr_pages, BITPERBYTE)) {
+ if (info->bufsize_cyclic % max_block_size) {
unsigned long bufsize;
if (max_block_size > info->bufsize_cyclic) {
--
1.8.3.1

View File

@ -1,105 +0,0 @@
From 92563d7a7a5175ef78c4a94ee269b1b455331b4c Mon Sep 17 00:00:00 2001
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Date: Tue, 17 Sep 2013 15:29:33 +0900
Subject: [PATCH] [PATCH 1/2] cache: Allocate buffers at initialization to
detect malloc() failure.
malloc() is used in cache_alloc() but there's no check for it. If I
added check in cache_alloc() directly, cache_alloc() needs to return
one more error status and code gets somewhat complicated. Instead, I
move malloc() in initial() to detect allocation failure at
initialization. By this change, 8 buffers are allocated at the same
time, no longer incrementally. However, 8 buffers are almost always
used throughout execution. There's essential differnece from the
incremental one.
Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
---
cache.c | 29 ++++++++++++++++++++++-------
cache.h | 1 +
makedumpfile.c | 3 +++
3 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/makedumpfile-1.5.4/cache.c b/makedumpfile-1.5.4/cache.c
index 3bea089..dad8d80 100644
--- a/makedumpfile-1.5.4/cache.c
+++ b/makedumpfile-1.5.4/cache.c
@@ -18,6 +18,7 @@
#include "makedumpfile.h"
#include "cache.h"
+#include "print_info.h"
struct cache_entry {
unsigned long long paddr;
@@ -36,6 +37,25 @@ static int avail = CACHE_SIZE;
static struct cache used, pending;
+int
+cache_init(void)
+{
+ void *bufptr;
+ int i;
+
+ for (i = 0; i < CACHE_SIZE; ++i) {
+ bufptr = malloc(info->page_size);
+ if (bufptr == NULL) {
+ ERRMSG("Can't allocate memory for cache. %s\n",
+ strerror(errno));
+ return FALSE;
+ }
+ pool[i].bufptr = bufptr;
+ }
+
+ return TRUE;
+}
+
static void
add_entry(struct cache *cache, struct cache_entry *entry)
{
@@ -83,13 +103,8 @@ cache_alloc(unsigned long long paddr)
{
struct cache_entry *entry = NULL;
- if (avail) {
- void *bufptr = malloc(info->page_size);
- if (bufptr) {
- entry = &pool[--avail];
- entry->bufptr = bufptr;
- }
- }
+ if (avail)
+ entry = &pool[--avail];
if (!entry) {
if (used.tail) {
diff --git a/makedumpfile-1.5.4/cache.h b/makedumpfile-1.5.4/cache.h
index f37d883..4730e12 100644
--- a/makedumpfile-1.5.4/cache.h
+++ b/makedumpfile-1.5.4/cache.h
@@ -19,6 +19,7 @@
#ifndef _CACHE_H
#define _CACHE_H
+int cache_init(void);
void *cache_search(unsigned long long paddr);
void *cache_alloc(unsigned long long paddr);
void cache_add(unsigned long long paddr);
diff --git a/makedumpfile-1.5.4/makedumpfile.c b/makedumpfile-1.5.4/makedumpfile.c
index 1718f88..e01ff50 100644
--- a/makedumpfile-1.5.4/makedumpfile.c
+++ b/makedumpfile-1.5.4/makedumpfile.c
@@ -3017,6 +3017,9 @@ out:
DEBUG_MSG("Buffer size for the cyclic mode: %ld\n", info->bufsize_cyclic);
}
+ if (!cache_init())
+ return FALSE;
+
if (debug_info) {
if (info->flag_sadump)
(void) sadump_virt_phys_base();
--
1.8.3.1

View File

@ -1,120 +0,0 @@
From e23dc0a1aa5fa7a4429f72ff1c2fe87a87291065 Mon Sep 17 00:00:00 2001
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Date: Tue, 17 Sep 2013 15:29:38 +0900
Subject: [PATCH] [PATCH 2/2] cache: Reuse entry in pending list.
Currently, sadump_virt_phys_base() fails to calculate phys_base as
below:
$ /pub/repos/makedumpfile/makedumpfile -f -p -d 31 -x /pub3/vmcores/comparevmcore_data/vmlinux-2.6.18-363.el5 /pub3/vmcores/comparevmcore_data/vmcore-2.6.18-363.el5-sadump /pub3/vmcores/comparevmcore_data/vmcore-pd31
Switched running mode from cyclic to non-cyclic,
because the cyclic mode doesn't support sadump format.
readmem: type_addr: 1, addr:296020, size:13
readmem: type_addr: 1, addr:ffffffffff296020, size:13
readmem: type_addr: 1, addr:ffffffffff396020, size:13
readmem: type_addr: 1, addr:ffffffffff496020, size:13
readmem: type_addr: 1, addr:ffffffffff596020, size:13
readmem: type_addr: 1, addr:ffffffffff696020, size:13
readmem: type_addr: 1, addr:ffffffffff796020, size:13
readmem: type_addr: 1, addr:ffffffffff896020, size:13
readmem: type_addr: 1, addr:ffffffffff996020, size:13
readmem: type_addr: 1, addr:ffffffffffa96020, size:13
readmem: type_addr: 1, addr:ffffffffffb96020, size:13
readmem: type_addr: 1, addr:ffffffffffc96020, size:13
readmem: type_addr: 1, addr:ffffffffffd96020, size:13
readmem: type_addr: 1, addr:ffffffffffe96020, size:13
readmem: type_addr: 1, addr:fffffffffff96020, size:13
readmem: type_addr: 1, addr:96020, size:13
readmem: type_addr: 1, addr:196020, size:13
readmem: type_addr: 1, addr:296020, size:13
readmem: type_addr: 1, addr:396020, size:13
readmem: type_addr: 1, addr:496020, size:13
readmem: type_addr: 1, addr:596020, size:13
readmem: type_addr: 1, addr:696020, size:13
readmem: type_addr: 1, addr:796020, size:13
readmem: type_addr: 1, addr:896020, size:13
readmem: type_addr: 1, addr:996020, size:13
readmem: type_addr: 1, addr:a96020, size:13
readmem: type_addr: 1, addr:b96020, size:13
readmem: type_addr: 1, addr:c96020, size:13
readmem: type_addr: 1, addr:d96020, size:13
readmem: type_addr: 1, addr:e96020, size:13
readmem: type_addr: 1, addr:f96020, size:13
readmem: type_addr: 1, addr:1096020, size:13
readmem: type_addr: 1, addr:1196020, size:13
readmem: type_addr: 1, addr:1296020, size:13
readmem: type_addr: 0, addr:ffffffff8045e260, size:32
cpu_online_mask_init: Can't read cpu_online_mask memory.
makedumpfile Failed.
By git bisect, I found this bug is caused by the following commit:
commit 0aff0e5174d0708bf1bfb039ab863e1fea8a1029
Author: Petr Tesarik <ptesarik@suse.cz>
Date: Wed Oct 31 16:12:47 2012 +0900
[PATCH] keep dumpfile pages in a cache.
Then, I found this bug happens in the following senario.
If one of the readpage_xxx() methods fails reading 8 pages in a row, 8
entries in pool are fully contained in pending list. Then,
cache_alloc() returns NULL and this continues forever in the
execution. In other words, there's assumption in cache_alloc() that if
pool is fully used, they are fully in used list, not in pending list
at all. However, the buggy path here breaks the assumption. This patch
changes cache_alloc() so that it first tries to reuse enty in pending
list if exists.
In fact, I found this bug in ad-hoc phys_base calculation performed in
sadump_virt_phys_base(). However, I fixed cache side since this bug
can occur in general on every vmcore format. Crash dump can contain
broken data in any part of vmcore and so requested physical address to
read can be broken likewise.
Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
---
cache.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/makedumpfile-1.5.4/cache.c b/makedumpfile-1.5.4/cache.c
index dad8d80..0dd957c 100644
--- a/makedumpfile-1.5.4/cache.c
+++ b/makedumpfile-1.5.4/cache.c
@@ -103,19 +103,20 @@ cache_alloc(unsigned long long paddr)
{
struct cache_entry *entry = NULL;
- if (avail)
+ if (avail) {
entry = &pool[--avail];
-
- if (!entry) {
- if (used.tail) {
- entry = used.tail;
- remove_entry(&used, entry);
- } else
- return NULL;
- }
-
- entry->paddr = paddr;
- add_entry(&pending, entry);
+ entry->paddr = paddr;
+ add_entry(&pending, entry);
+ } else if (pending.tail) {
+ entry = pending.tail;
+ entry->paddr = paddr;
+ } else if (used.tail) {
+ entry = used.tail;
+ remove_entry(&used, entry);
+ entry->paddr = paddr;
+ add_entry(&pending, entry);
+ } else
+ return NULL;
return entry->bufptr;
}
--
1.8.3.1

View File

@ -13,7 +13,7 @@ Source5: kdump.sysconfig.ppc64
Source6: kdump.sysconfig.ia64
Source7: mkdumprd
Source8: kdump.conf
Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.5.4/makedumpfile-1.5.4.tar.gz
Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.5.5/makedumpfile-1.5.5.tar.gz
Source10: kexec-kdump-howto.txt
Source11: firstboot_kdump.py
Source12: mkdumprd.8
@ -68,8 +68,6 @@ Patch101: kexec-tools-2.0.4-kdump-x86-Process-multiple-Crash-kernel-in-proc-iome
#
# Patches 301 through 400 are meant for ppc64 kexec-tools enablement
#
Patch301: kexec-tools-2.0.4-makedumpfile-Add-vmap_area_list-definition-for-ppc-ppc64.patch
Patch302: kexec-tools-2.0.4-makedumpfile-Support-to-filter-dump-for-kernels-that-use.patch
#
# Patches 401 through 500 are meant for s390 kexec-tools enablement
@ -83,19 +81,7 @@ Patch302: kexec-tools-2.0.4-makedumpfile-Support-to-filter-dump-for-kernels-that
#
Patch601: kexec-tools-2.0.3-disable-kexec-test.patch
Patch604: kexec-tools-2.0.3-build-makedumpfile-eppic-shared-object.patch
Patch605: kexec-tools-2.0.4-makedumpfile-PATCH-Support-newer-kernels.patch
Patch606: kexec-tools-2.0.4-makedumpfile-Fix-max_mapnr-issue-on-system-has-over-44-b.patch
Patch607: kexec-tools-2.0.4-makedumpfile-Update-pfn_cyclic-when-the-cyclic-buffer-size-.patch
Patch608: kexec-tools-2.0.4-makedumpfile-Use-divideup-to-calculate-maximum-required-bit.patch
Patch609: kexec-tools-2.0.4-makedumpfile-cache-Allocate-buffers-at-initialization-t.patch
Patch610: kexec-tools-2.0.4-makedumpfile-cache-Reuse-entry-in-pending-list.patch
Patch612: kexec-tools-2.0.4-makedumpfile-Understand-v3.11-rc4-dmesg.patch
Patch613: kexec-tools-2.0.4-makedumpfile-Assign-non-printable-value-as-short-option.patch
Patch614: kexec-tools-2.0.4-makedumpfile-Add-help-and-man-message-for-help.patch
Patch615: kexec-tools-2.0.4-makedumpfile-Add-non-mmap-option-to-disable-mmap-manually.patch
Patch616: kexec-tools-2.0.4-makedumpfile-Fall-back-to-read-when-mmap-fails.patch
Patch617: kexec-tools-2.0.4-vmcore-dmesg-struct_val_u64-not-casting-u64-to-u32.patch
Patch618: kexec-tools-2.0.4-makedumpfile-Improve-progress-information-for-huge-memor.patch
%description
kexec-tools provides /sbin/kexec binary that facilitates a new
@ -125,26 +111,12 @@ tar -z -x -v -f %{SOURCE19}
%patch101 -p1
%patch301 -p1
%patch601 -p1
%patch604 -p1
%patch605 -p1
%patch606 -p1
%patch607 -p1
%patch608 -p1
%patch609 -p1
%patch610 -p1
%patch001 -p1
%patch002 -p1
%patch003 -p1
%patch612 -p1
%patch302 -p1
%patch613 -p1
%patch614 -p1
%patch615 -p1
%patch616 -p1
%patch617 -p1
%patch618 -p1
tar -z -x -v -f %{SOURCE13}
@ -175,7 +147,7 @@ cp %{SOURCE10} .
make
%ifarch %{ix86} x86_64 ia64 ppc64 s390x
make -C eppic/libeppic
make -C makedumpfile-1.5.4 LINKTYPE=dynamic USELZO=on USESNAPPY=on
make -C makedumpfile-1.5.5 LINKTYPE=dynamic USELZO=on USESNAPPY=on
%endif
make -C kexec-tools-po
@ -216,11 +188,11 @@ mkdir -p $RPM_BUILD_ROOT/usr/sbin
install -m 755 %{SOURCE17} $RPM_BUILD_ROOT/usr/sbin/rhcrashkernel-param
%ifarch %{ix86} x86_64 ia64 ppc64 s390x
install -m 755 makedumpfile-1.5.4/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile
install -m 644 makedumpfile-1.5.4/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz
install -m 644 makedumpfile-1.5.4/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz
install -m 644 makedumpfile-1.5.4/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample
install -m 755 makedumpfile-1.5.4/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so
install -m 755 makedumpfile-1.5.5/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile
install -m 644 makedumpfile-1.5.5/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz
install -m 644 makedumpfile-1.5.5/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz
install -m 644 makedumpfile-1.5.5/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample
install -m 755 makedumpfile-1.5.5/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so
%endif
make -C kexec-tools-po install DESTDIR=$RPM_BUILD_ROOT
%find_lang %{name}

View File

@ -1,4 +1,4 @@
b48eb2726d602c1aa3abfd3739441f54 eppic_030413.tar.gz
05992bc8c0673fc55be7b6d27e48a8db kexec-tools-2.0.4.tar.bz2
150a0952212efd10fa041e4b0582115f makedumpfile-1.5.4.tar.gz
ba3710c36b287b6a61b2867b4c9b6478 kexec-tools-po-20131224.tgz
70ff343bbe6657b69beb23458e3e0b98 makedumpfile-1.5.5.tar.gz