* [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 2/2] Get Dom0 max_pfn using pfn_mfn_frame_list if max_pfn unavailable
2014-03-27 18:06 ` Petr Tesarik
@ 2014-03-27 18:06 ` Petr Tesarik
0 siblings, 0 replies; 2+ messages in thread
From: Petr Tesarik @ 2014-03-27 18:06 UTC (permalink / raw)
To: Atsushi Kumagai; +Cc: kexec, Petr Tesarik
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
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