After commit ec5b5835a113cf62a168d4a7354564a38de6b52c, makedumpfile fails on
Xen dumps unless the "max_pfn" symbol is known. This happens even when the
dump level is 0 and 1, where it worked previously. This is especially bad for
kernels which do not put the "max_pfn" symbol into its ELF VMCOREINFO.

With this patch, the "max_pfn" symbol is required only if the specified
dump level needs it.

Signed-off-by: Petr Tesarik <[email protected]>

---
 makedumpfile.c |   33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -143,13 +143,15 @@ get_dom0_mapnr()
 {
        unsigned long max_pfn;
 
-       if (SYMBOL(max_pfn) == NOT_FOUND_SYMBOL)
-               return FALSE;
-
-       if (!readmem(VADDR, SYMBOL(max_pfn), &max_pfn, sizeof max_pfn))
-               return FALSE;
+       if (SYMBOL(max_pfn) != NOT_FOUND_SYMBOL) {
+               if (!readmem(VADDR, SYMBOL(max_pfn), &max_pfn, sizeof max_pfn)) 
{
+                       ERRMSG("Can't read domain-0 max_pfn.\n");
+                       return FALSE;
+               }
 
-       info->dom0_mapnr = max_pfn;
+               info->dom0_mapnr = max_pfn;
+               DEBUG_MSG("domain-0 pfn : %llx\n", info->dom0_mapnr);
+       }
 
        return TRUE;
 }
@@ -2430,14 +2432,6 @@ get_mem_map(void)
 {
        int ret;
 
-       if (is_xen_memory()) {
-               if (!get_dom0_mapnr()) {
-                       ERRMSG("Can't domain-0 pfn.\n");
-                       return FALSE;
-               }
-               DEBUG_MSG("domain-0 pfn : %llx\n", info->dom0_mapnr);
-       }
-
        switch (get_mem_type()) {
        case SPARSEMEM:
                DEBUG_MSG("\n");
@@ -3475,6 +3469,10 @@ exclude_free_page(void)
                ERRMSG("Can't get necessary structures for excluding free 
pages.\n");
                return FALSE;
        }
+       if (is_xen_memory() && !info->dom0_mapnr) {
+               ERRMSG("Can't get max domain-0 PFN for excluding free 
pages.\n");
+               return FALSE;
+       }
 
        /*
         * Detect free pages and update 2nd-bitmap.
@@ -3749,6 +3747,11 @@ exclude_unnecessary_pages(void)
        struct mem_map_data *mmd;
        struct timeval tv_start;
 
+       if (is_xen_memory() && !info->dom0_mapnr) {
+               ERRMSG("Can't get max domain-0 PFN for excluding pages.\n");
+               return FALSE;
+       }
+
        gettimeofday(&tv_start, NULL);
 
        for (mm = 0; mm < info->num_mem_map; mm++) {
@@ -5816,6 +5819,8 @@ initial_xen(void)
 out:
        if (!get_max_mapnr())
                return FALSE;
+       if (!get_dom0_mapnr())
+               return FALSE;
 
        return TRUE;
 #endif



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Reply via email to