From: Petr Tesarik <petr@xxxxxxxxxxx> 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 at suse.cz> --- makedumpfile.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/makedumpfile.c b/makedumpfile.c index 1117598..341fbe8 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