ia64/xen-unstable

changeset 338:0e31b8633858

bitkeeper revision 1.153 (3e7a3a53LJF3EAuJITGpo9ybSgxf2w)

config.h, domain.c, dom_mem_ops.c, TODO:
Fixed out of memory handling so we don't hang. Updated TODO file.
author kaf24@scramble.cl.cam.ac.uk
date Thu Mar 20 22:01:55 2003 +0000 (2003-03-20)
parents b7fe2b3fb737
children edd0a15b4e05
files xen/TODO xen/common/dom_mem_ops.c xen/common/domain.c xen/include/xeno/config.h
line diff
     1.1 --- a/xen/TODO	Thu Mar 20 21:14:29 2003 +0000
     1.2 +++ b/xen/TODO	Thu Mar 20 22:01:55 2003 +0000
     1.3 @@ -44,7 +44,15 @@ order to requests, just as we already do
     1.4  rings. We'll need to add an opaque identifier to ring entries,
     1.5  allowing matching of requests and responses, but that's about it.
     1.6  
     1.7 -4. GDT AND LDT VIRTUALISATION 
     1.8 +4. NETWORK CHECKSUM OFFLOAD 
     1.9 +--------------------------- 
    1.10 +All the NICs that we support can checksum packets on behalf of guest
    1.11 +OSes. We need to add appropriate flags to and from each domain to
    1.12 +indicate, on transmit, which packets need the checksum added and, on
    1.13 +receive, which packets have been checked out as okay. We can steal
    1.14 +Linux's interface, which is entirely sane given NIC limitations.
    1.15 +
    1.16 +5. GDT AND LDT VIRTUALISATION 
    1.17  ----------------------------- 
    1.18  We do not allow modification of the GDT, or any use of the LDT. This
    1.19  is necessary for support of unmodified applications (eg. Linux uses
    1.20 @@ -55,14 +63,14 @@ I have some text on how to do this:
    1.21  /usr/groups/xeno/discussion-docs/memory_management/segment_tables.txt
    1.22  It's already half implemented, but the rest is still to do.
    1.23  
    1.24 -5. DOMAIN 0 MANAGEMENT DAEMON
    1.25 +6. DOMAIN 0 MANAGEMENT DAEMON
    1.26  -----------------------------
    1.27  A better control daemon is required for domain 0, which keeps proper
    1.28  track of machine resources and can make sensible policy choices. This
    1.29  may require support in Xen; for example, notifications (eg. DOMn is
    1.30  killed), and requests (eg. can DOMn allocate x frames of memory?).
    1.31  
    1.32 -6. ACCURATE TIMERS AND WALL-CLOCK TIME
    1.33 +7. ACCURATE TIMERS AND WALL-CLOCK TIME
    1.34  --------------------------------------
    1.35  Currently our long-term timebase free runs on CPU0, with no external
    1.36  calibration. We should run ntpd on domain 0 and allow this to warp
    1.37 @@ -70,7 +78,7 @@ Xen's timebase. Once this is done, we ca
    1.38  not worry about relative drift (since they'll all get sync'ed
    1.39  periodically by ntp).
    1.40  
    1.41 -7. NEW DESIGN FEATURES
    1.42 +8. NEW DESIGN FEATURES
    1.43  ----------------------
    1.44  This includes the last-chance page cache, and the unified buffer cache.
    1.45  
     2.1 --- a/xen/common/dom_mem_ops.c	Thu Mar 20 21:14:29 2003 +0000
     2.2 +++ b/xen/common/dom_mem_ops.c	Thu Mar 20 22:01:55 2003 +0000
     2.3 @@ -29,14 +29,24 @@ static long alloc_dom_mem(struct task_st
     2.4      unsigned long     i;
     2.5      unsigned long     flags;
     2.6  
     2.7 -    /* POLICY DECISION: Each domain has a page limit. */
     2.8 -    if( (p->tot_pages + bop.size) > p->max_pages )
     2.9 +    /*
    2.10 +     * POLICY DECISION: Each domain has a page limit.
    2.11 +     * NB. The first part of test is because bop.size could be so big that
    2.12 +     * tot_pages + bop.size overflows a u_long.
    2.13 +     */
    2.14 +    if( (bop.size > p->max_pages) ||
    2.15 +        ((p->tot_pages + bop.size) > p->max_pages) )
    2.16          return -ENOMEM;
    2.17  
    2.18 -    if ( free_pfns < bop.size ) 
    2.19 +    spin_lock_irqsave(&free_list_lock, flags);
    2.20 +
    2.21 +    if ( free_pfns < (bop.size + (SLACK_DOMAIN_MEM_KILOBYTES << 
    2.22 +                                  (PAGE_SHIFT-10))) ) 
    2.23 +    {
    2.24 +        spin_unlock_irqrestore(&free_list_lock, flags);
    2.25          return -ENOMEM;
    2.26 -    
    2.27 -    spin_lock_irqsave(&free_list_lock, flags);
    2.28 +    }
    2.29 +
    2.30      spin_lock(&p->page_lock);
    2.31      
    2.32      temp = free_list.next;
     3.1 --- a/xen/common/domain.c	Thu Mar 20 21:14:29 2003 +0000
     3.2 +++ b/xen/common/domain.c	Thu Mar 20 22:01:55 2003 +0000
     3.3 @@ -161,8 +161,13 @@ unsigned int alloc_new_dom_mem(struct ta
     3.4      spin_lock_irqsave(&free_list_lock, flags);
     3.5      
     3.6      /* is there enough mem to serve the request? */   
     3.7 -    if ( req_pages > free_pfns ) return -1;
     3.8 -    
     3.9 +    if ( (req_pages + (SLACK_DOMAIN_MEM_KILOBYTES << (PAGE_SHIFT-10))) >
    3.10 +         free_pfns )
    3.11 +    {
    3.12 +        spin_unlock_irqrestore(&free_list_lock, flags);
    3.13 +        return -1;
    3.14 +    }
    3.15 +
    3.16      /* allocate pages and build a thread through frame_table */
    3.17      temp = free_list.next;
    3.18      for ( alloc_pfns = 0; alloc_pfns < req_pages; alloc_pfns++ )
     4.1 --- a/xen/include/xeno/config.h	Thu Mar 20 21:14:29 2003 +0000
     4.2 +++ b/xen/include/xeno/config.h	Thu Mar 20 22:01:55 2003 +0000
     4.3 @@ -85,6 +85,12 @@
     4.4  #define IOREMAP_VIRT_START    (MAPCACHE_VIRT_END)
     4.5  #define IOREMAP_VIRT_END      (IOREMAP_VIRT_START + (4*1024*1024))
     4.6  
     4.7 +/*
     4.8 + * Amount of slack domain memory to leave in system, in megabytes.
     4.9 + * Prevents a hard out-of-memory crunch for thinsg like network receive.
    4.10 + */
    4.11 +#define SLACK_DOMAIN_MEM_KILOBYTES 1024
    4.12 +
    4.13  /* Linkage for x86 */
    4.14  #define FASTCALL(x)     x __attribute__((regparm(3)))
    4.15  #define asmlinkage        __attribute__((regparm(0)))