Hello,
makedumpfile can be used to save just the dom0 memory in case of a crash.
We need this feature to quickly restart systems with a huge amount of
(domU) memory. Unfortunately makedumpfile has not yet been ported to Xen 4.
So I gave it a try and I plan to send patches to the makedumpfile
project. The makedumpfile project leader asked me to also send the patches to
the xen-devel mailing list. Let me start with the code for determining
the dom0 pages in Xen 4. If you care please let me know about any faults or
improvements.
Thanks
Norbert
The function exclude_xen_user_domain() determines the dom0 and xen
pages and clears a bit in a bitmap for all other pages.
The function is_select_domain() determines whether the parameter is the pickled_id
of dom0.
#define BITS_PER_LONG 64
#define PG_shift(idx) (BITS_PER_LONG - (idx))
#define PG_mask(x, idx) (x ## UL << PG_shift(idx))
#define PGC_state_inuse PG_mask(0, 9)
#define PGC_allocated PG_mask(1, 1)
#define PGC_xen_heap PG_mask(1, 2)
#define PGC_state_free PG_mask(3, 9)
int
exclude_xen_user_domain(void)
{
int i;
unsigned long count_info;
unsigned int _domain;
unsigned long page_info_addr;
unsigned long long pfn, pfn_end;
unsigned long long j, size;
struct pt_load_segment *pls;
for (i = 0; i < info->num_load_memory; i++) {
pls = &info->pt_load_segments[i];
pfn = paddr_to_pfn(pls->phys_start);
pfn_end = paddr_to_pfn(pls->phys_end);
size = pfn_end - pfn;
for (j = 0; pfn < pfn_end; pfn++, j++) {
page_info_addr = info->frame_table_vaddr + pfn * SIZE(page_info);
if (!readmem(VADDR_XEN,
page_info_addr + OFFSET(page_info.count_info),
&count_info, sizeof(count_info))) {
clear_bit_on_2nd_bitmap(pfn);
continue; /* page_info may not exist */
}
if (!readmem(VADDR_XEN,
page_info_addr + OFFSET(page_info._domain),
&_domain, sizeof(_domain))) {
ERRMSG("Can't get page_info._domain.\n");
return FALSE;
}
if (count_info & PGC_state_free) {
clear_bit_on_2nd_bitmap(pfn);
continue;
}
if (count_info & PGC_xen_heap) {
continue;
}
if (count_info & PGC_allocated) {
if (_domain == 0) {
continue;
}
if (is_select_domain(_domain)) {
continue;
} else {
clear_bit_on_2nd_bitmap(pfn);
continue;
}
}
if (count_info == PGC_state_inuse) {
continue;
}
clear_bit_on_2nd_bitmap(pfn);
}
}
return TRUE;
}
With kind regards
Norbert Trapp
PDG ES&S SWE OS 6
FUJITSU
Fujitsu Technology Solutions GmbH
Domagkstraße 28, D-80807 München, Germany
E-Mail: Norbert.Trapp@xxxxxxxxxxxxxx