|
|
1d9674 |
From a02f5f078ce635dd1633dab70869306b0a62e2e2 Mon Sep 17 00:00:00 2001
|
|
|
1d9674 |
From: Pratyush Anand <panand@redhat.com>
|
|
|
1d9674 |
Date: Thu, 17 Aug 2017 12:47:13 +0900
|
|
|
1d9674 |
Subject: [PATCH v2] Fix SECTION_MAP_MASK for kernel >= v.13
|
|
|
1d9674 |
|
|
|
1d9674 |
* Required for kernel 4.13
|
|
|
1d9674 |
|
|
|
1d9674 |
commit 2d070eab2e82 "mm: consider zone which is not fully populated to
|
|
|
1d9674 |
have holes" added a new flag SECTION_IS_ONLINE and therefore
|
|
|
1d9674 |
SECTION_MAP_MASK has been changed. We are not able to find correct
|
|
|
1d9674 |
mem_map in makedumpfile for kernel version v4.13-rc1 and onward because
|
|
|
1d9674 |
of the above kernel change.
|
|
|
1d9674 |
|
|
|
1d9674 |
This patch fixes the MASK value keeping the code backward compatible
|
|
|
1d9674 |
|
|
|
1d9674 |
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
|
|
1d9674 |
---
|
|
|
1d9674 |
makedumpfile.c | 5 ++++-
|
|
|
1d9674 |
makedumpfile.h | 4 +++-
|
|
|
1d9674 |
2 files changed, 7 insertions(+), 2 deletions(-)
|
|
|
1d9674 |
|
|
|
1d9674 |
diff --git a/makedumpfile-1.6.2/makedumpfile.c b/makedumpfile-1.6.2/makedumpfile.c
|
|
|
1d9674 |
index 8af0c9d..5096319 100644
|
|
|
1d9674 |
--- a/makedumpfile-1.6.2/makedumpfile.c
|
|
|
1d9674 |
+++ b/makedumpfile-1.6.2/makedumpfile.c
|
|
|
1d9674 |
@@ -3304,7 +3304,10 @@ section_mem_map_addr(unsigned long addr)
|
|
|
1d9674 |
return NOT_KV_ADDR;
|
|
|
1d9674 |
}
|
|
|
1d9674 |
map = ULONG(mem_section + OFFSET(mem_section.section_mem_map));
|
|
|
1d9674 |
- map &= SECTION_MAP_MASK;
|
|
|
1d9674 |
+ if (info->kernel_version < KERNEL_VERSION(4, 13, 0))
|
|
|
1d9674 |
+ map &= SECTION_MAP_MASK_4_12;
|
|
|
1d9674 |
+ else
|
|
|
1d9674 |
+ map &= SECTION_MAP_MASK;
|
|
|
1d9674 |
free(mem_section);
|
|
|
1d9674 |
|
|
|
1d9674 |
return map;
|
|
|
1d9674 |
diff --git a/makedumpfile-1.6.2/makedumpfile.h b/makedumpfile-1.6.2/makedumpfile.h
|
|
|
1d9674 |
index b0cdd02..6f188e4 100644
|
|
|
1d9674 |
--- a/makedumpfile-1.6.2/makedumpfile.h
|
|
|
1d9674 |
+++ b/makedumpfile-1.6.2/makedumpfile.h
|
|
|
1d9674 |
@@ -183,7 +183,9 @@ isAnon(unsigned long mapping)
|
|
|
1d9674 |
#define SECTIONS_PER_ROOT() (info->sections_per_root)
|
|
|
1d9674 |
#define SECTION_ROOT_MASK() (SECTIONS_PER_ROOT() - 1)
|
|
|
1d9674 |
#define SECTION_NR_TO_ROOT(sec) ((sec) / SECTIONS_PER_ROOT())
|
|
|
1d9674 |
-#define SECTION_MAP_LAST_BIT (1UL<<2)
|
|
|
1d9674 |
+#define SECTION_IS_ONLINE (1UL<<2)
|
|
|
1d9674 |
+#define SECTION_MAP_LAST_BIT (1UL<<3)
|
|
|
1d9674 |
+#define SECTION_MAP_MASK_4_12 (~(SECTION_IS_ONLINE-1))
|
|
|
1d9674 |
#define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1))
|
|
|
1d9674 |
#define NR_SECTION_ROOTS() divideup(num_section, SECTIONS_PER_ROOT())
|
|
|
1d9674 |
#define SECTION_NR_TO_PFN(sec) ((sec) << PFN_SECTION_SHIFT())
|
|
|
1d9674 |
--
|
|
|
1d9674 |
2.7.4
|
|
|
1d9674 |
|