tools/libs/ctrl: fix dumping of ballooned guest
PATCH 1/1 tools/libs/ctrl: fix dumping of ballooned guest
A guest with memory < maxmem can't be dumped via xl dump-core without an error message today:
xc: info: exceeded nr_pages (262144) losing pages
In case the last page of the guest isn't allocated the loop in xc_domain_dumpcore_via_callback() will always spit out this message, as the number of already dumped pages is tested before the next page is checked to be valid.
Signed-off-by Juergen Gross <[email protected]>
---
Unfortunately this patch isn't a complete fix, while I believe it is needed. There is still a mismatch of exactly 1 page. I have no idea where this could come from.
Signed-off-by Juergen Gross <[email protected]>
--- tools/libs/ctrl/xc_core.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-)
tools/libs/ctrl/xc_core.c +21 -11
@@ -818,16 +818,6 @@ xc_domain_dumpcore_via_callback(xc_interface *xch, {uint64_t gmfn;void *vaddr; - -if ( j >= nr_pages ) - { -/* -* When live dump-mode (-L option) is specified, -* guest domain may increase memory. -*/ -IPRINTF ("exceeded nr_pages (%ld) losing pages" , nr_pages); - goto copy_done; - }if ( !auto_translated_physmap ) {
@@ -847,6 +837,12 @@ xc_domain_dumpcore_via_callback(xc_interface *xch,continue ; } +if ( j >= nr_pages ) + { + j++; +continue ; + } + p2m_array[j].pfn = i; p2m_array[j].gmfn = gmfn; }
@@ -855,6 +851,12 @@ xc_domain_dumpcore_via_callback(xc_interface *xch,if ( !xc_core_arch_gpfn_may_present (&arch_ctxt, i) )continue ; +if ( j >= nr_pages ) + { + j++; +continue ; + } + gmfn = i; pfn_array[j] = i; }
@@ -879,7 +881,15 @@ xc_domain_dumpcore_via_callback(xc_interface *xch, } } -copy_done: +if ( j > nr_pages ) + { +/* +* When live dump-mode (-L option) is specified, +* guest domain may increase memory. +*/ +IPRINTF ("exceeded nr_pages (%ld) losing %ld pages" , nr_pages, j - nr_pages); + } + sts =dump_rtn (xch, args, dump_mem_start, dump_mem - dump_mem_start);if ( sts !=0 ) goto out;
Signature · 1 line
2.26.2