[PATCH] [kdump] Find the PAGESIZE from VMCOREINFO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



{ PS: Missed this one in the series posted under 
   [PATCH v3 0/4] Kdump core analysis support for PPC32 
}

This patch adds support for finding the page size of the crashed system from
the VMCOREINFO when available. If it is not available, fall back to the old
methods. This is more useful when we do cross-arch core dump analysis.

Signed-off-by: Suzuki K. Poulose <suzuki@xxxxxxxxxx>
---

 netdump.c |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/netdump.c b/netdump.c
index f7bf7d8..3228316 100644
--- a/netdump.c
+++ b/netdump.c
@@ -2700,6 +2700,25 @@ get_kdump_regs(struct bt_info *bt, ulong *eip, ulong *esp)
 	get_netdump_regs(bt, eip, esp);
 }
 
+/*
+ * Get the pagesize of the system from the VMCORE
+ * if it is available.
+ */
+static uint
+get_pagesize_vmcoreinfo()
+{
+	uint pagesz;
+	char *buf = nd->vmcoreinfo;
+
+	if(!buf)
+		return 0;
+	buf = strstr(buf, "PAGESIZE=");
+	if (!buf)
+		return 0;
+	sscanf(buf,"PAGESIZE=%d\n",&pagesz);
+	return pagesz;
+}
+
 uint
 kdump_page_size(void)
 {
@@ -2708,8 +2727,12 @@ kdump_page_size(void)
         if (!VMCORE_VALID())
                 return 0;
 
-	if (!(pagesz = nd->page_size))
-                pagesz = (uint)getpagesize();
+	if (!(pagesz = nd->page_size)) {
+		if (nd->vmcoreinfo)
+			nd->page_size = pagesz = get_pagesize_vmcoreinfo();
+		if (!pagesz)
+	                pagesz = (uint)getpagesize();
+	}
 
         return pagesz;
 }

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility


[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux