Blame SOURCES/kexec-tools-2.0.15-makedumpfile-Fix-SECTION_MAP_MASK-for-kernel-v.13.patch

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