|
|
26a7a5 |
From 3adf612137e8e488fe721ba154c089efbfead30a Mon Sep 17 00:00:00 2001
|
|
|
26a7a5 |
From: Pingfan Liu <piliu@redhat.com>
|
|
|
26a7a5 |
Date: Wed, 8 Aug 2018 13:21:44 +0800
|
|
|
26a7a5 |
Subject: [PATCH] [PATCH v3] when refiltering, initialize refiltered bitmap2
|
|
|
26a7a5 |
from the kdump file's bitmap2
|
|
|
26a7a5 |
|
|
|
26a7a5 |
When refiltering on kdump format file, there is no info about pt_load[] for
|
|
|
26a7a5 |
exclude_nodata_pages(), and also we can not expect more data than the kdump
|
|
|
26a7a5 |
file can provide, hence this patch suggests to initialize the refiltered
|
|
|
26a7a5 |
bitmap2 from the kdump file's bitmap2. As for the statistic of pfn_memhole,
|
|
|
26a7a5 |
it should be calculated and discount the bits in kdump file's bitmap1.
|
|
|
26a7a5 |
|
|
|
26a7a5 |
Note about the bug reported by the following ops:
|
|
|
26a7a5 |
makedumpfile -l --message-level 1 -d 31 /proc/vmcore /path/to/vmcore
|
|
|
26a7a5 |
makedumpfile --split -d 31 ./vmcore dumpfile_{1,2,3} 2>&1
|
|
|
26a7a5 |
And get the following error:
|
|
|
26a7a5 |
Excluding unnecessary pages : [100.0 %] \
|
|
|
26a7a5 |
readpage_kdump_compressed: pfn(9b) is excluded from /var/crash/127.0.0.1-2018-07-02-22:10:38/vmcore.
|
|
|
26a7a5 |
readmem: type_addr: 1, addr:9b000, size:4096
|
|
|
26a7a5 |
read_pfn: Can't get the page data.
|
|
|
26a7a5 |
writeout_multiple_dumpfiles: Child process(2277) finished incompletely.(256)
|
|
|
26a7a5 |
Copying data : [ 24.6 %] - eta: 2s
|
|
|
26a7a5 |
makedumpfile Failed.
|
|
|
26a7a5 |
|
|
|
26a7a5 |
Cc: Kazuhito Hagio <k-hagio@ab.jp.nec.com>
|
|
|
26a7a5 |
Signed-off-by: Pingfan Liu <piliu@redhat.com>
|
|
|
26a7a5 |
---
|
|
|
26a7a5 |
makedumpfile.c | 40 +++++++++++++++++++++++++++++++++++-----
|
|
|
26a7a5 |
1 file changed, 35 insertions(+), 5 deletions(-)
|
|
|
26a7a5 |
|
|
|
26a7a5 |
diff --git a/makedumpfile-1.6.2/makedumpfile.c b/makedumpfile-1.6.2/makedumpfile.c
|
|
|
26a7a5 |
index 915cbf4..3ccdaae 100644
|
|
|
26a7a5 |
--- a/makedumpfile-1.6.2/makedumpfile.c
|
|
|
26a7a5 |
+++ b/makedumpfile-1.6.2/makedumpfile.c
|
|
|
26a7a5 |
@@ -5516,6 +5516,27 @@ out:
|
|
|
26a7a5 |
"follow free lists instead of mem_map array.\n");
|
|
|
26a7a5 |
}
|
|
|
26a7a5 |
|
|
|
26a7a5 |
+static mdf_pfn_t count_bits(char *buf, int sz)
|
|
|
26a7a5 |
+{
|
|
|
26a7a5 |
+ char *p = buf;
|
|
|
26a7a5 |
+ int i, j;
|
|
|
26a7a5 |
+ mdf_pfn_t cnt = 0;
|
|
|
26a7a5 |
+
|
|
|
26a7a5 |
+ for (i = 0; i < sz; i++, p++) {
|
|
|
26a7a5 |
+ if (*p == 0)
|
|
|
26a7a5 |
+ continue;
|
|
|
26a7a5 |
+ else if (*p == 0xff) {
|
|
|
26a7a5 |
+ cnt += 8;
|
|
|
26a7a5 |
+ continue;
|
|
|
26a7a5 |
+ }
|
|
|
26a7a5 |
+ for (j = 0; j < 8; j++) {
|
|
|
26a7a5 |
+ if (*p & (1<
|
|
|
26a7a5 |
+ cnt++;
|
|
|
26a7a5 |
+ }
|
|
|
26a7a5 |
+ }
|
|
|
26a7a5 |
+ return cnt;
|
|
|
26a7a5 |
+}
|
|
|
26a7a5 |
+
|
|
|
26a7a5 |
/*
|
|
|
26a7a5 |
* If using a dumpfile in kdump-compressed format as a source file
|
|
|
26a7a5 |
* instead of /proc/vmcore, 1st-bitmap of a new dumpfile must be
|
|
|
26a7a5 |
@@ -5549,6 +5570,7 @@ copy_1st_bitmap_from_memory(void)
|
|
|
26a7a5 |
info->name_memory, strerror(errno));
|
|
|
26a7a5 |
return FALSE;
|
|
|
26a7a5 |
}
|
|
|
26a7a5 |
+ pfn_memhole -= count_bits(buf, sizeof(buf));
|
|
|
26a7a5 |
if (write(info->bitmap1->fd, buf, sizeof(buf)) != sizeof(buf)) {
|
|
|
26a7a5 |
ERRMSG("Can't write the bitmap(%s). %s\n",
|
|
|
26a7a5 |
info->bitmap1->file_name, strerror(errno));
|
|
|
26a7a5 |
@@ -6093,19 +6115,27 @@ copy_bitmap_buffer(void)
|
|
|
26a7a5 |
int
|
|
|
26a7a5 |
copy_bitmap_file(void)
|
|
|
26a7a5 |
{
|
|
|
26a7a5 |
- off_t offset;
|
|
|
26a7a5 |
+ off_t base, offset = 0;
|
|
|
26a7a5 |
unsigned char buf[info->page_size];
|
|
|
26a7a5 |
const off_t failed = (off_t)-1;
|
|
|
26a7a5 |
+ int fd;
|
|
|
26a7a5 |
+ struct disk_dump_header *dh = info->dh_memory;
|
|
|
26a7a5 |
|
|
|
26a7a5 |
- offset = 0;
|
|
|
26a7a5 |
+ if (info->flag_refiltering) {
|
|
|
26a7a5 |
+ fd = info->fd_memory;
|
|
|
26a7a5 |
+ base = (DISKDUMP_HEADER_BLOCKS + dh->sub_hdr_size) * dh->block_size;
|
|
|
26a7a5 |
+ base += info->len_bitmap / 2;
|
|
|
26a7a5 |
+ } else {
|
|
|
26a7a5 |
+ fd = info->bitmap1->fd;
|
|
|
26a7a5 |
+ base = info->bitmap1->offset;
|
|
|
26a7a5 |
+ }
|
|
|
26a7a5 |
while (offset < (info->len_bitmap / 2)) {
|
|
|
26a7a5 |
- if (lseek(info->bitmap1->fd, info->bitmap1->offset + offset,
|
|
|
26a7a5 |
- SEEK_SET) == failed) {
|
|
|
26a7a5 |
+ if (lseek(fd, base + offset, SEEK_SET) == failed) {
|
|
|
26a7a5 |
ERRMSG("Can't seek the bitmap(%s). %s\n",
|
|
|
26a7a5 |
info->name_bitmap, strerror(errno));
|
|
|
26a7a5 |
return FALSE;
|
|
|
26a7a5 |
}
|
|
|
26a7a5 |
- if (read(info->bitmap1->fd, buf, sizeof(buf)) != sizeof(buf)) {
|
|
|
26a7a5 |
+ if (read(fd, buf, sizeof(buf)) != sizeof(buf)) {
|
|
|
26a7a5 |
ERRMSG("Can't read the dump memory(%s). %s\n",
|
|
|
26a7a5 |
info->name_memory, strerror(errno));
|
|
|
26a7a5 |
return FALSE;
|
|
|
26a7a5 |
--
|
|
|
26a7a5 |
2.7.4
|
|
|
26a7a5 |
|