kexec-tools/kexec-tools-2.0.15-makedumpfile-fix-SECTION_MAP_MASK-for-kernel-bigger-than-4.13.patch
Dave Young 4384995b3d makedumpfile: fix 4.13 kernel larget vmcore bug
Added patch from panand which was accepted by upstream but not merged in upstream yet.
kexec-tools-2.0.15-makedumpfile-fix-SECTION_MAP_MASK-for-kernel-bigger-than-4.13.patch
2017-08-17 16:50:23 +08:00

67 lines
2.6 KiB
Diff

From: Pratyush Anand <panand@redhat.com>
To: ats-kumagai@wm.jp.nec.com
Subject: [Makedumpfile PATCH v2] Fix SECTION_MAP_MASK for kernel >= v.13
Date: Thu, 17 Aug 2017 09:16:59 +0530
Cc: Pratyush Anand <panand@redhat.com>, dyoung@redhat.com,
kexec@lists.infradead.org, bhe@redhat.com
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=utf-8
commit 2d070eab2e82 "mm: consider zone which is not fully populated to
have holes" added a new flag SECTION_IS_ONLINE and therefore
SECTION_MAP_MASK has been changed. We are not able to find correct
mem_map in makedumpfile for kernel version v4.13-rc1 and onward because
of the above kernel change.
This patch fixes the MASK value keeping the code backward compatible
Signed-off-by: Pratyush Anand <panand@redhat.com>
---
v1->v2: Improved kernel_version comparison to take care of stable kernel
versions as well.
makedumpfile.c | 5 ++++-
makedumpfile.h | 4 +++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git kexec-tools-2.0.15/makedumpfile-1.6.2/makedumpfile.c kexec-tools-2.0.15.new/makedumpfile-1.6.2/makedumpfile.c
index 30230a15a2e7..c975651ca357 100644
--- kexec-tools-2.0.15/makedumpfile-1.6.2/makedumpfile.c
+++ kexec-tools-2.0.15.new/makedumpfile-1.6.2/makedumpfile.c
@@ -3304,7 +3304,10 @@ section_mem_map_addr(unsigned long addr)
return NOT_KV_ADDR;
}
map = ULONG(mem_section + OFFSET(mem_section.section_mem_map));
- map &= SECTION_MAP_MASK;
+ if (info->kernel_version < KERNEL_VERSION(4, 13, 0))
+ map &= SECTION_MAP_MASK_4_12;
+ else
+ map &= SECTION_MAP_MASK;
free(mem_section);
return map;
diff --git kexec-tools-2.0.15/makedumpfile-1.6.2/makedumpfile.h kexec-tools-2.0.15.new/makedumpfile-1.6.2/makedumpfile.h
index 8a05794843fb..322f28c632b0 100644
--- kexec-tools-2.0.15/makedumpfile-1.6.2/makedumpfile.h
+++ kexec-tools-2.0.15.new/makedumpfile-1.6.2/makedumpfile.h
@@ -183,7 +183,9 @@ isAnon(unsigned long mapping)
#define SECTIONS_PER_ROOT() (info->sections_per_root)
#define SECTION_ROOT_MASK() (SECTIONS_PER_ROOT() - 1)
#define SECTION_NR_TO_ROOT(sec) ((sec) / SECTIONS_PER_ROOT())
-#define SECTION_MAP_LAST_BIT (1UL<<2)
+#define SECTION_IS_ONLINE (1UL<<2)
+#define SECTION_MAP_LAST_BIT (1UL<<3)
+#define SECTION_MAP_MASK_4_12 (~(SECTION_IS_ONLINE-1))
#define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1))
#define NR_SECTION_ROOTS() divideup(num_section, SECTIONS_PER_ROOT())
#define SECTION_NR_TO_PFN(sec) ((sec) << PFN_SECTION_SHIFT())
--
2.9.4
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec