[makedumpfile][patch] handle !SPARSEMEM_EX properly

Daisuke Nishimura nishimura at mxp.nes.nec.co.jp
Mon Apr 5 22:45:49 EDT 2010


In !SPARSEMEM_EX case, the symbol mem_section points a array of struct mem_section,
doesn't point a array of pointer to mem_section[], so I think the check:

	if (!is_kvaddr(mem_sec[SECTION_NR_TO_ROOT(nr)]))
		return NOT_KV_ADDR;

in nr_to_section() is not a valid check in this case.

To make the matters worse, if CONFIG_CGROUP_MEM_RES_CTLR is enabled, the end of
struct mem_section is padded with 0.

So, reading mem_section by "rd" of crash will look like:

	crash> rd mem_section 128
	c08b71e0:  c9002003 c9001200 f7000000 00000000   . ..............
	c08b71f0:  c9002003 c9001260 f6980000 00000000   . ..`...........
	c08b7200:  c9002003 c90012c0 f6300000 00000000   . ........0.....
	c08b7210:  c9002003 c9001320 f5c80000 00000000   . .. ...........
	...

This means nr_to_section() will return 0 when "nr" is 3,7,11,... because it meets
the condition(mem_sec[SECTION_NR_TO_ROOT(nr)] == mem_sec[nr] == 0 == !is_kvaddr).

As a result, mem_map for section 3,7,11,... cannot be handled properly.

This patch is a fix for this problem. nr_to_section() will check "addr" by
is_kvaddr() later anyway, so this patch just removes the problematic check.

Signed-off-by: Masayuki Igawa <igawa at mxs.nes.nec.co.jp>
Signed-off-by: Daisuke Nishimura <nishimura at mxp.nes.nec.co.jp>
---
diff --git a/makedumpfile.c b/makedumpfile.c
index 855c718..73fa94f 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -3547,9 +3547,6 @@ nr_to_section(unsigned long nr, unsigned long *mem_sec)
 {
 	unsigned long addr;
 
-	if (!is_kvaddr(mem_sec[SECTION_NR_TO_ROOT(nr)]))
-		return NOT_KV_ADDR;
-
 	if (is_sparsemem_extreme())
 		addr = mem_sec[SECTION_NR_TO_ROOT(nr)] +
 		    (nr & SECTION_ROOT_MASK()) * SIZE(mem_section);



More information about the kexec mailing list