From: Petr Tesarik <ptesarik@suse.cz>
To: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
Cc: kexec@lists.infradead.org, Petr Tesarik <ptesarik@suse.cz>
Subject: [PATCH 2/2] Get Dom0 max_pfn using pfn_mfn_frame_list if max_pfn unavailable
Date: Thu, 27 Mar 2014 19:06:16 +0100 [thread overview]
Message-ID: <1395943576-25362-3-git-send-email-ptesarik@suse.cz> (raw)
In-Reply-To: <1395943576-25362-1-git-send-email-ptesarik@suse.cz>
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
next prev parent reply other threads:[~2014-03-27 18:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
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 1/2] Earlier initialization of dom0_mapnr Petr Tesarik
2014-03-28 8:18 ` Atsushi Kumagai
2014-03-28 8:26 ` Petr Tesarik
2014-03-28 9:01 ` Atsushi Kumagai
2014-03-28 12:08 ` [PATCH v2 0/2] Allow Xen Dom0 page filtering Petr Tesarik
2014-03-28 12:08 ` [PATCH v2 1/2] Earlier initialization of dom0_mapnr Petr Tesarik
2014-03-28 12:08 ` [PATCH v2 2/2] Get Dom0 max_pfn using pfn_mfn_frame_list if max_pfn unavailable Petr Tesarik
2014-03-28 12:08 ` [PATCH 0/2] Allow Xen Dom0 page filtering Petr Tesarik
2014-04-03 2:38 ` [PATCH v2 " Atsushi Kumagai
2014-03-28 12:09 ` Petr Tesarik
2014-03-28 12:09 ` [PATCH v2 1/2] Earlier initialization of dom0_mapnr Petr Tesarik
2014-03-28 12:09 ` [PATCH v2 2/2] Get Dom0 max_pfn using pfn_mfn_frame_list if max_pfn unavailable Petr Tesarik
2014-03-27 18:06 ` Petr Tesarik [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-03-27 17:43 [PATCH " Petr Tesarik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1395943576-25362-3-git-send-email-ptesarik@suse.cz \
--to=ptesarik@suse.cz \
--cc=kexec@lists.infradead.org \
--cc=kumagai-atsushi@mxc.nes.nec.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox