[Crash-utility] [PATCH] Fix reading x86_64 xendump cores on 2.6.27+

Petr Tesarik ptesarik at suse.cz
Fri Jun 18 14:44:55 UTC 2010


Hi,

the crash utility is unable to read xendump cores from kernel versions
2.6.27 or newer. Bernhard fixed this only for kdump Xen cores.

With 2.6.27 and newer kernels, the max_pfn symbol should be used
to get the highest PFN in the system. However, xendump code still
tries to use end_pfn. Without the patch, early initialization
fails with the error message: "crash: cannot resolve "end_pfn".

Signed-off-by: Petr Tesarik <ptesarik at suse.cz>

---
 x86_64.c |   22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

--- a/x86_64.c
+++ b/x86_64.c
@@ -4851,6 +4851,7 @@ x86_64_xen_kdump_p2m_create(struct xen_k
         ulong frames;
         ulong frame_mfn[MAX_X86_64_FRAMES] = { 0 };
         int mfns[MAX_X86_64_FRAMES] = { 0 };
+	struct syment *sp;
 
         /*
          *  Temporarily read physical (machine) addresses from vmcore by
@@ -4932,7 +4933,15 @@ use_cr3:
                 x86_64_debug_dump_page(fp, machdep->machspec->pml4,
                         "contents of PML4 page:");
 
-	kvaddr = symbol_value("end_pfn");
+	/*
+	 * kernel version <  2.6.27 => end_pfn
+	 * kernel version >= 2.6.27 => max_pfn
+	 */
+	if ((sp = symbol_search("end_pfn")))
+		kvaddr = sp->value;
+	else
+		kvaddr = symbol_value("max_pfn");
+
         if (!x86_64_xen_kdump_load_page(kvaddr, xkd->page))
                 return FALSE;
         up = (ulong *)(xkd->page + PAGEOFFSET(kvaddr));
@@ -5262,6 +5271,7 @@ x86_64_xendump_p2m_create(struct xendump
 	ulong mfn, kvaddr, ctrlreg[8], ctrlreg_offset;
 	ulong *up;
 	off_t offset; 
+	struct syment *sp;
 
         if (!symbol_exists("phys_to_machine_mapping")) {
                 xd->flags |= XC_CORE_NO_P2M;
@@ -5299,7 +5309,15 @@ x86_64_xendump_p2m_create(struct xendump
 		x86_64_debug_dump_page(xd->ofp, machdep->machspec->pml4, 
                 	"contents of PML4 page:");
 
-	kvaddr = symbol_value("end_pfn");
+	/*
+	 * kernel version <  2.6.27 => end_pfn
+	 * kernel version >= 2.6.27 => max_pfn
+	 */
+	if ((sp = symbol_search("end_pfn")))
+		kvaddr = sp->value;
+	else
+		kvaddr = symbol_value("max_pfn");
+
 	if (!x86_64_xendump_load_page(kvaddr, xd))
 		return FALSE;
 





More information about the Crash-utility mailing list