linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2] mm/sparse: reset section's mem_map when fully deactivated
@ 2020-01-20  2:33 Pingfan Liu
  2020-01-20  7:29 ` Michal Hocko
  0 siblings, 1 reply; 7+ messages in thread
From: Pingfan Liu @ 2020-01-20  2:33 UTC (permalink / raw)
  To: linux-mm
  Cc: Pingfan Liu, Andrew Morton, David Hildenbrand, Dan Williams,
	Oscar Salvador, Michal Hocko, Baoquan He, Qian Cai, kexec,
	Kazuhito Hagio

After commit ba72b4c8cf60 ("mm/sparsemem: support sub-section hotplug"),
when a mem section is fully deactivated, section_mem_map still records the
section's start pfn, which is not used any more and will be reassigned
during re-added.

In analogy with alloc/free pattern, it is better to clear all fields of
section_mem_map.

Beside this, it breaks the user space tool "makedumpfile" [1], which makes
assumption that a hot-removed section has mem_map as NULL, instead of
checking directly against SECTION_MARKED_PRESENT bit. (makedumpfile will be
better to change the assumption, and need a patch)

The bug can be reproduced on IBM POWERVM by "drmgr -c mem -r -q 5" ,
trigger a crash, and save vmcore by makedumpfile

[1]: makedumpfile, commit e73016540293 ("[v1.6.7] Update version")

Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
To: linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Baoquan He <bhe@redhat.com>
Cc: Qian Cai <cai@lca.pw>
Cc: kexec@lists.infradead.org
Cc: Kazuhito Hagio <k-hagio@ab.jp.nec.com>
---
v1 -> v2:
 make an explicit convertion from NULL to ulong
 improve commit log
 
 mm/sparse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/sparse.c b/mm/sparse.c
index 3822ecb..3918fc3 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -789,7 +789,7 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages,
 			ms->usage = NULL;
 		}
 		memmap = sparse_decode_mem_map(ms->section_mem_map, section_nr);
-		ms->section_mem_map = sparse_encode_mem_map(NULL, section_nr);
+		ms->section_mem_map = (unsigned long)NULL;
 	}
 
 	if (section_is_early && memmap)
-- 
2.7.5



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-01-25 13:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20  2:33 [PATCHv2] mm/sparse: reset section's mem_map when fully deactivated Pingfan Liu
2020-01-20  7:29 ` Michal Hocko
2020-01-20  9:03   ` David Hildenbrand
2020-01-20 10:12     ` Pingfan Liu
2020-01-24  3:10   ` Andrew Morton
2020-01-24  6:49     ` Michal Hocko
2020-01-25 13:26       ` Pingfan Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox