[PATCH 2/5] Move xen p2m map initialization to xen_kdump_p2m

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

 



There is currently only one caller of xen_kdump_p2m() and it must
ensure that the p2m map is created before calling this function.
If there are multiple callers, this code would have to be repeated,
so it's better to put it directly into xen_kdump_p2m.

Signed-off-by: Petr Tesarik <ptesarik@xxxxxxxx>
---
 netdump.c  | 18 ------------------
 xen_dom0.c | 17 +++++++++++++++++
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/netdump.c b/netdump.c
index 38ddc8f..3a2df55 100644
--- a/netdump.c
+++ b/netdump.c
@@ -3708,24 +3708,6 @@ read_kdump(int fd, void *bufptr, int cnt, ulong addr, physaddr_t paddr)
 	}
 
 	if (XEN_CORE_DUMPFILE() && !XEN_HYPER_MODE()) {
-		struct xen_kdump_data *xkd = get_xen_kdump_data();
-		if (!(xkd->flags & KDUMP_P2M_INIT)) {
-        		if (!machdep->xen_kdump_p2m_create)
-                		error(FATAL,
-                            "xen kdump dumpfiles not supported on this architecture\n");
-
-			if ((xkd->page =
-			    (char *)malloc(PAGESIZE())) == NULL)
-				error(FATAL,
-				    "cannot malloc xen kdump data page\n");
-
-			if (!machdep->xen_kdump_p2m_create(xkd))
-                		error(FATAL,
-                    	    "cannot create xen kdump pfn-to-mfn mapping\n");
-
-			xkd->flags |= KDUMP_P2M_INIT;
-		}
-
 		if ((paddr = xen_kdump_p2m(paddr)) == P2M_FAILURE) {
 			if (CRASHDEBUG(8)) 
 				fprintf(fp, "read_kdump: xen_kdump_p2m(%llx): "
diff --git a/xen_dom0.c b/xen_dom0.c
index 547f3a1..826a90b 100644
--- a/xen_dom0.c
+++ b/xen_dom0.c
@@ -168,6 +168,23 @@ xen_kdump_p2m(physaddr_t pseudo)
 	if (pc->curcmd_flags & XEN_MACHINE_ADDR)
 		return pseudo;
 
+	if (!(xkd->flags & KDUMP_P2M_INIT)) {
+		if (!machdep->xen_kdump_p2m_create)
+			error(FATAL,
+			      "xen kdump dumpfiles not supported on this architecture\n");
+
+		if ((xkd->page =
+		     (char *)malloc(PAGESIZE())) == NULL)
+			error(FATAL,
+			      "cannot malloc xen kdump data page\n");
+
+		if (!machdep->xen_kdump_p2m_create(xkd))
+			error(FATAL,
+			      "cannot create xen kdump pfn-to-mfn mapping\n");
+
+		xkd->flags |= KDUMP_P2M_INIT;
+	}
+
 #ifdef IA64
 	return ia64_xen_kdump_p2m(xkd, pseudo);
 #endif
-- 
2.1.4

--
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