[PATCH 2/2] makedumpfile: Use max_pfn from mem_map array

Michael Holzheu holzheu at linux.vnet.ibm.com
Tue Apr 1 05:20:11 EDT 2014


On Tue, 1 Apr 2014 05:06:33 +0000
Atsushi Kumagai <kumagai-atsushi at mxc.nes.nec.co.jp> wrote:

[...]

> >OTOH, Michal's patch is still neded to fix non-Xen non-cyclic dumps.
> 
> Yes, the fix for create_1st_bitmap() is still necessary.
> 
> Michael, could you fix your patch ? We need to add the conditional
> check for Xen like below:
> 
> +	if (!is_xen_memory()) {
> +	       for (i = 0; i < info->num_mem_map; i++) {
> +   	            if (info->mem_map_data[i].mem_map == NOT_MEMMAP_ADDR)
> +       	                continue;
> +           	    max_pfn = MAX(max_pfn, info->mem_map_data[i].pfn_end);
> +       	}
> +       	info->max_mapnr = MIN(info->max_mapnr, max_pfn);
> +	}

Hello Atsushi and Petr,

Based on the discussion I removed the checks in exclude_xen3_user_domain()
and exclude_xen4_user_domain() and added the is_xen_memory() check
int get_mem_map().

Here the updated patch:
---
[PATCH] makedumpfile: Fix bitmap create for adjusted info->max_mapnr

If info->max_mapnr has been adjusted, for example because the dumped
system has specified the "mem=" kernel parameter, makedumpfile writes
the following error messages for Xen dumps or when the "--non-cyclic"
option has been specified:

set_bitmap: Can't read the bitmap(/tmp/kdump_bitmapBsKAUe). Invalid argument

Fix this and consider "info->max_mapnr" in the create_1st_bitmap() function.

In addition to this, do not adjust max_mapnr for Xen dumps.
For Xen info->max_mapnr gives the maximum machine PFN and the data
in mem_section describes the Dom0 kernel memory map that gets
initialized from info->dom0_mapnr. It may be substantially smaller
than info->max_mapnr.

Signed-off-by: Michael Holzheu <holzheu at linux.vnet.ibm.com>
---
 makedumpfile.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -2868,12 +2868,14 @@ get_mem_map(void)
 	 * than is dumped. For example when "mem=" has been used for the
 	 * dumped system.
 	 */
-	for (i = 0; i < info->num_mem_map; i++) {
-		if (info->mem_map_data[i].mem_map == NOT_MEMMAP_ADDR)
-			continue;
-		max_pfn = MAX(max_pfn, info->mem_map_data[i].pfn_end);
+	if (!is_xen_memory()) {
+		for (i = 0; i < info->num_mem_map; i++) {
+			if (info->mem_map_data[i].mem_map == NOT_MEMMAP_ADDR)
+				continue;
+			max_pfn = MAX(max_pfn, info->mem_map_data[i].pfn_end);
+		}
+		info->max_mapnr = MIN(info->max_mapnr, max_pfn);
 	}
-	info->max_mapnr = MIN(info->max_mapnr, max_pfn);
 	return ret;
 }
 
@@ -4402,6 +4404,9 @@ create_1st_bitmap(void)
 
 		pfn_start = paddr_to_pfn(phys_start);
 		pfn_end   = paddr_to_pfn(phys_end);
+		if (pfn_start > info->max_mapnr)
+			continue;
+		pfn_end = MIN(pfn_end, info->max_mapnr);
 
 		for (pfn = pfn_start; pfn < pfn_end; pfn++) {
 			set_bit_on_1st_bitmap(pfn);




More information about the kexec mailing list