[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [makedumpfile] makedumpfile port to Xen 4 (exclude_xen_user_domain)


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Trapp, Norbert" <norbert.trapp@xxxxxxxxxxxxxx>
  • Date: Tue, 16 Aug 2011 18:06:19 +0200
  • Accept-language: de-DE, en-US
  • Acceptlanguage: de-DE, en-US
  • Delivery-date: Tue, 16 Aug 2011 16:43:32 -0700
  • Domainkey-signature: s=s1536a; d=ts.fujitsu.com; c=nofws; q=dns; h=X-SBRSScore:X-IronPort-AV:Received:Received:From:To:Date: Subject:Thread-Topic:Thread-Index:Message-ID: Accept-Language:Content-Language:X-MS-Has-Attach: X-MS-TNEF-Correlator:acceptlanguage:Content-Type: MIME-Version; b=I9F/sdKBxQWj3uvRcKbNOHrP3axMdZnPycBl0U+GX2K/r8cJbJ1+ayWH 7HNPKEtP7ja1ptYICOC3eth1JtJ/Kt/cBHj92nMmFutSOiQQRTPD+YAyB V3pUBT1uGDWy66OmeEL40noClQdu/+AR0RRfRzLFuduivJJmPy0lWCLl8 df5pMe/5ETcQnAHPzhj1pFTMSaVMOrLNvKDRWaj/XRiZwtJCWV3CIbw3B AK6CnLGeDjwolhQ4U56s6dlnRcnxv;
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AcxcLm+DOfg60BIxQXGTbAjdkqYJeg==
  • Thread-topic: [Xen-devel] [makedumpfile] makedumpfile port to Xen 4 (exclude_xen_user_domain)

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
Company details: ts.fujitsu.com/imprint
 
 
 
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.