Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] Get Dom0 max_pfn using pfn_mfn_frame_list if max_pfn unavailable
@ 2014-03-27 17:43 Petr Tesarik
  0 siblings, 0 replies; 2+ messages in thread
From: Petr Tesarik @ 2014-03-27 17:43 UTC (permalink / raw)
  To: Atsushi Kumagai; +Cc: kexec

If max_pfn symbol is not exported in the Dom0 kernel's VMCOREINFO, the
maximum PFN can be determined from the size of the mapping between PFN
and MFN.

Using this approach, filtering works for Xen kernels without debuginfo
(and even without adding more lines to VMCOREINFO).

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
 makedumpfile.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index d3f5237..92e8a6a 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -189,9 +189,30 @@ get_dom0_mapnr()
 		}
 
 		info->dom0_mapnr = max_pfn;
-		DEBUG_MSG("domain-0 pfn : %llx\n", info->dom0_mapnr);
+	} else if (info->p2m_frames) {
+		unsigned long mfns[MFNS_PER_FRAME];
+		unsigned long mfn_idx = info->p2m_frames - 1;
+		unsigned long long maddr;
+		unsigned i;
+
+		maddr = pfn_to_paddr(info->p2m_mfn_frame_list[mfn_idx]);
+		if (!readmem(MADDR_XEN, maddr, &mfns, sizeof(mfns))) {
+			ERRMSG("Can't read %ld domain-0 mfns at 0x%llu\n",
+				(long)MFNS_PER_FRAME, maddr);
+			return FALSE;
+		}
+
+		for (i = 0; i < MFNS_PER_FRAME; ++i)
+			if (!mfns[i])
+				break;
+
+		info->dom0_mapnr = mfn_idx * MFNS_PER_FRAME + i;
+	} else {
+		/* dom0_mapnr is unavailable, which may be non-critical */
+		return TRUE;
 	}
 
+	DEBUG_MSG("domain-0 pfn : %llx\n", info->dom0_mapnr);
 	return TRUE;
 }
 
-- 
1.8.4.5


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 2+ messages in thread
* [PATCH 0/2] Allow Xen Dom0 page filtering
@ 2014-03-27 17:49 Petr Tesarik
  2014-03-27 18:06 ` Petr Tesarik
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Tesarik @ 2014-03-27 17:49 UTC (permalink / raw)
  To: Atsushi Kumagai; +Cc: kexec

Trying to use makedumpfile on a Xen Dom0 ELF file currently fails, but there
are in fact only a few missing pieces. With the following two patches, I was
able to produce a dump even with high dump levels (-d17 and -d31).

Needless to say, this can reduce the size of Dom0 dumps considerably.

Petr Tesarik (2):
  Earlier initialization of dom0_mapnr
  Get Dom0 max_pfn using pfn_mfn_frame_list if max_pfn unavailable

 makedumpfile.c | 35 ++++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)

-- 
1.8.4.5


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-27 18:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-27 17:43 [PATCH 2/2] Get Dom0 max_pfn using pfn_mfn_frame_list if max_pfn unavailable Petr Tesarik
  -- strict thread matches above, loose matches on Subject: below --
2014-03-27 17:49 [PATCH 0/2] Allow Xen Dom0 page filtering Petr Tesarik
2014-03-27 18:06 ` Petr Tesarik
2014-03-27 18:06   ` [PATCH 2/2] Get Dom0 max_pfn using pfn_mfn_frame_list if max_pfn unavailable Petr Tesarik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox