WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

Re: [Xen-ia64-devel] [Patch] allocate all memory to dom0

To: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-ia64-devel] [Patch] allocate all memory to dom0
From: Mark Williamson <mark.williamson@xxxxxxxxxxxx>
Date: Thu, 18 Jan 2007 04:23:10 +0000
Delivery-date: Wed, 17 Jan 2007 20:22:28 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <46C73AB61814D1takebe_akio@xxxxxxxxxxxxxx>
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
References: <46C73AB61814D1takebe_akio@xxxxxxxxxxxxxx>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.5
Hi,

> If we don't specify dom0_mem, we can use all memory on dom0 with this
> patch. I change alloc_dom0() to alloc_dom0_size(), and alloc_dom0_size() is
> static function.

On x86, we've found that if dom0 is initially started with all the memory in 
the machine allocated to it (and then automatically ballooned down as domains 
are created) it's possible for Linux to get a bit confused.

Ballooning down dom0 lots makes the kernel think there's some sort of memory 
crunch, when in actual fact there isn't.  We find the best configuration is 
to explicitly set dom0_mem where possible, although it's nice to have it use 
all the memory as a sensible default.

Just thought I'd mention this issue, although I do think it's a good idea to 
default to giving dom0 all of the available memory in the absence of other 
directives.

Cheers,
Mark

> # HG changeset patch
> # User root@PQtest
> # Node ID 1625e2ba02fcb2c7d162e178a045b7d540a213f1
> # Parent  a2b2b2a011f1d406d49caba478020f3b2b173cb8
> allocate all memory to dom0, if we don't specify dom0_mem.
>
> Signed-off-by: Akio Takebe <takebe_akio@xxxxxxxxxxxxxx>
>
> diff -r a2b2b2a011f1 -r 1625e2ba02fc xen/arch/ia64/xen/domain.c
> --- a/xen/arch/ia64/xen/domain.c      Mon Jan 15 15:15:26 2007 -0700
> +++ b/xen/arch/ia64/xen/domain.c      Thu Jan 18 13:45:00 2007 +0900
> @@ -50,7 +50,7 @@
>  #include <asm/tlb_track.h>
>  #include <asm/perfmon.h>
>
> -unsigned long dom0_size = 512*1024*1024;
> +unsigned long dom0_size = 0;
>
>  /* dom0_max_vcpus: maximum number of VCPUs to create for dom0.  */
>  static unsigned int dom0_max_vcpus = 1;
> @@ -936,16 +936,24 @@ static void loaddomainelfimage(struct do
>       }
>  }
>
> -void alloc_dom0(void)
> -{
> +static void alloc_dom0_size(void)
> +{
> +     unsigned long max_dom0_pages;
> +
> +     if ( dom0_size == 0 )
> +     {
> +             max_dom0_pages = avail_domheap_pages() - 
> min(avail_domheap_pages() /
> 16UL, 512UL << (20 - PAGE_SHIFT)) ; +         dom0_size = max_dom0_pages *
> PAGE_SIZE;
> +     }
> +
> +     if (running_on_sim) {
> +             dom0_size = 128*1024*1024; //FIXME: Should be configurable
> +     }
> +
>       /* Check dom0 size.  */
>       if (dom0_size < 4 * 1024 * 1024) {
>               panic("dom0_mem is too small, boot aborted"
>                       " (try e.g. dom0_mem=256M or dom0_mem=65536K)\n");
> -     }
> -
> -     if (running_on_sim) {
> -             dom0_size = 128*1024*1024; //FIXME: Should be configurable
>       }
>
>       /* no need to allocate pages for now
> @@ -1008,6 +1016,8 @@ int construct_dom0(struct domain *d,
>       memset(&dsi, 0, sizeof(struct domain_setup_info));
>
>       printk("*** LOADING DOMAIN 0 ***\n");
> +
> +     alloc_dom0_size();
>
>       max_pages = dom0_size / PAGE_SIZE;
>       d->max_pages = max_pages;
> diff -r a2b2b2a011f1 -r 1625e2ba02fc xen/arch/ia64/xen/xensetup.c
> --- a/xen/arch/ia64/xen/xensetup.c    Mon Jan 15 15:15:26 2007 -0700
> +++ b/xen/arch/ia64/xen/xensetup.c    Thu Jan 18 13:45:00 2007 +0900
> @@ -43,7 +43,6 @@ extern void early_setup_arch(char **);
>  extern void early_setup_arch(char **);
>  extern void late_setup_arch(char **);
>  extern void hpsim_serial_init(void);
> -extern void alloc_dom0(void);
>  extern void setup_per_cpu_areas(void);
>  extern void mem_init(void);
>  extern void init_IRQ(void);
> @@ -409,8 +408,6 @@ void start_kernel(void)
>
>      trap_init();
>
> -    alloc_dom0();
> -
>      end_boot_allocator();
>
>      init_xenheap_pages(__pa(xen_heap_start), xenheap_phys_end);
>
> Best Regards,
>
> Akio Takebe

-- 
Dave: Just a question. What use is a unicyle with no seat?  And no pedals!
Mark: To answer a question with a question: What use is a skateboard?
Dave: Skateboards have wheels.
Mark: My wheel has a wheel!

_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel

<Prev in Thread] Current Thread [Next in Thread>