Blame SOURCES/kexec-tools-2.0.20-makedumpfile-PATCH-cope-with-not-present-mem-section.patch

1a067e
From e113f1c974c820f9633dc0073eda525d7575f365 Mon Sep 17 00:00:00 2001
1a067e
From: Pingfan Liu <piliu@redhat.com>
1a067e
Date: Mon, 20 Jan 2020 10:25:24 +0800
1a067e
Subject: [PATCH 3/7] [PATCH] cope with not-present mem section
1a067e
1a067e
After kernel commit ba72b4c8cf60 ("mm/sparsemem: support sub-section
1a067e
hotplug"), when hot-removed, section_mem_map is still encoded with section
1a067e
start pfn, not NULL. This break the current makedumpfile.
1a067e
1a067e
  # makedumpfile -x vmlinux -l -d 31 vmcore vmcore.dump
1a067e
  get_mem_section: Could not validate mem_section.
1a067e
  get_mm_sparsemem: Can't get the address of mem_section.
1a067e
1a067e
  makedumpfile Failed.
1a067e
1a067e
Whatever section_mem_map coding info after hot-removed, it is reliable
1a067e
just to work on SECTION_MARKED_PRESENT bit. Fixing makedumpfile by this
1a067e
way.
1a067e
1a067e
[ This issue occurs on kernel 5.3 through 5.5, and should be fixed by
1a067e
commit 1f503443e7df ("mm/sparse.c: reset section's mem_map when fully
1a067e
deactivated") in 5.6-rc1, 5.5.3 and 5.4.19. ]
1a067e
1a067e
Signed-off-by: Pingfan Liu <piliu@redhat.com>
1a067e
To: kexec@lists.infradead.org
1a067e
Cc: Kazuhito Hagio <k-hagio@ab.jp.nec.com>
1a067e
Cc: Baoquan He <bhe@redhat.com>
1a067e
Cc: David Hildenbrand <david@redhat.com>
1a067e
Cc: Andrew Morton <akpm@linux-foundation.org>
1a067e
Cc: Dan Williams <dan.j.williams@intel.com>
1a067e
Cc: Oscar Salvador <osalvador@suse.de>
1a067e
Cc: Michal Hocko <mhocko@kernel.org>
1a067e
Cc: Qian Cai <cai@lca.pw>
1a067e
---
1a067e
 makedumpfile.c | 6 +-----
1a067e
 1 file changed, 1 insertion(+), 5 deletions(-)
1a067e
1a067e
diff --git a/makedumpfile-1.6.7/makedumpfile.c b/makedumpfile-1.6.7/makedumpfile.c
1a067e
index ae7336a..607e07f 100644
1a067e
--- a/makedumpfile-1.6.7/makedumpfile.c
1a067e
+++ b/makedumpfile-1.6.7/makedumpfile.c
1a067e
@@ -3406,8 +3406,6 @@ section_mem_map_addr(unsigned long addr, unsigned long *map_mask)
1a067e
 	map = ULONG(mem_section + OFFSET(mem_section.section_mem_map));
1a067e
 	mask = SECTION_MAP_MASK;
1a067e
 	*map_mask = map & ~mask;
1a067e
-	if (map == 0x0)
1a067e
-		*map_mask |= SECTION_MARKED_PRESENT;
1a067e
 	map &= mask;
1a067e
 	free(mem_section);
1a067e
 
1a067e
@@ -3453,10 +3451,8 @@ validate_mem_section(unsigned long *mem_sec,
1a067e
 			mem_map = NOT_MEMMAP_ADDR;
1a067e
 		} else {
1a067e
 			mem_map = section_mem_map_addr(section, &map_mask);
1a067e
+			/* for either no mem_map or hot-removed */
1a067e
 			if (!(map_mask & SECTION_MARKED_PRESENT)) {
1a067e
-				return FALSE;
1a067e
-			}
1a067e
-			if (mem_map == 0) {
1a067e
 				mem_map = NOT_MEMMAP_ADDR;
1a067e
 			} else {
1a067e
 				mem_map = sparse_decode_mem_map(mem_map,
1a067e
-- 
1a067e
2.7.5
1a067e