[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Clean up management of 'initial images' temporary buffers.
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID 62309ca8b7086a83f151e626541dd43dc55d2a62 # Parent e5aba4f62131528f7f5526f7807784439aa2b8e2 Clean up management of 'initial images' temporary buffers. Avoid double-freeing boundary pages. Signed-off-by: Anthony Xu <anthony.xu@xxxxxxxxx> Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> diff -r e5aba4f62131 -r 62309ca8b708 xen/arch/x86/domain_build.c --- a/xen/arch/x86/domain_build.c Tue Feb 28 10:41:54 2006 +++ b/xen/arch/x86/domain_build.c Tue Feb 28 10:58:45 2006 @@ -27,6 +27,9 @@ #include <asm/shadow.h> #include <public/version.h> + +extern unsigned long initial_images_nrpages(void); +extern void discard_initial_images(void); static long dom0_nrpages; @@ -249,9 +252,6 @@ uint32_t dom0_features_supported[XENFEAT_NR_SUBMAPS] = { 0 }; uint32_t dom0_features_required[XENFEAT_NR_SUBMAPS] = { 0 }; - extern void translate_l2pgtable( - struct domain *d, l1_pgentry_t *p2m, unsigned long l2mfn); - /* Sanity! */ BUG_ON(d->domain_id != 0); BUG_ON(d->vcpu[0] == NULL); @@ -272,18 +272,14 @@ */ if ( dom0_nrpages == 0 ) { - dom0_nrpages = avail_domheap_pages() + - ((initrd_len + PAGE_SIZE - 1) >> PAGE_SHIFT) + - ((image_len + PAGE_SIZE - 1) >> PAGE_SHIFT); + dom0_nrpages = avail_domheap_pages() + initial_images_nrpages(); dom0_nrpages = min(dom0_nrpages / 16, 128L << (20 - PAGE_SHIFT)); dom0_nrpages = -dom0_nrpages; } /* Negative memory specification means "all memory - specified amount". */ if ( dom0_nrpages < 0 ) - nr_pages = avail_domheap_pages() + - ((initrd_len + PAGE_SIZE - 1) >> PAGE_SHIFT) + - ((image_len + PAGE_SIZE - 1) >> PAGE_SHIFT) + + nr_pages = avail_domheap_pages() + initial_images_nrpages() + dom0_nrpages; else nr_pages = dom0_nrpages; @@ -705,16 +701,12 @@ hypercall_page_initialise((void *)hypercall_page); } - init_domheap_pages( - _image_start, (_image_start+image_len+PAGE_SIZE-1) & PAGE_MASK); - - /* Copy the initial ramdisk and free temporary buffer. */ + /* Copy the initial ramdisk. */ if ( initrd_len != 0 ) - { memcpy((void *)vinitrd_start, initrd_start, initrd_len); - init_domheap_pages( - _initrd_start, (_initrd_start+initrd_len+PAGE_SIZE-1) & PAGE_MASK); - } + + /* Free temporary buffers. */ + discard_initial_images(); /* Set up start info area. */ si = (start_info_t *)vstartinfo_start; diff -r e5aba4f62131 -r 62309ca8b708 xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c Tue Feb 28 10:41:54 2006 +++ b/xen/arch/x86/setup.c Tue Feb 28 10:58:45 2006 @@ -144,6 +144,20 @@ static struct e820entry e820_raw[E820MAX]; +static unsigned long initial_images_start, initial_images_end; + +unsigned long initial_images_nrpages(void) +{ + unsigned long s = initial_images_start + PAGE_SIZE - 1; + unsigned long e = initial_images_end; + return ((e >> PAGE_SHIFT) - (s >> PAGE_SHIFT)); +} + +void discard_initial_images(void) +{ + init_domheap_pages(initial_images_start, initial_images_end); +} + void __init __start_xen(multiboot_info_t *mbi) { char *cmdline; @@ -152,7 +166,6 @@ unsigned int initrdidx = 1; module_t *mod = (module_t *)__va(mbi->mods_addr); unsigned long nr_pages, modules_length; - unsigned long initial_images_start, initial_images_end; paddr_t s, e; int i, e820_warn = 0, e820_raw_nr = 0, bytes = 0; struct ns16550_defaults ns16550 = { _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |