ia64/xen-unstable

changeset 6085:878ba6d3954e

Add padding to allocation bitmap. Should fix page fault
on x86/64 debug builds on some systems.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Aug 10 09:45:06 2005 +0000 (2005-08-10)
parents d77208361929
children 66e6479d9ab8 e87001315978
files xen/common/page_alloc.c
line diff
     1.1 --- a/xen/common/page_alloc.c	Wed Aug 10 09:09:15 2005 +0000
     1.2 +++ b/xen/common/page_alloc.c	Wed Aug 10 09:45:06 2005 +0000
     1.3 @@ -52,7 +52,6 @@ LIST_HEAD(page_scrub_list);
     1.4   *  One bit per page of memory. Bit set => page is allocated.
     1.5   */
     1.6  
     1.7 -static unsigned long  bitmap_size; /* in bytes */
     1.8  static unsigned long *alloc_bitmap;
     1.9  #define PAGES_PER_MAPWORD (sizeof(unsigned long) * 8)
    1.10  
    1.11 @@ -135,10 +134,16 @@ static void map_free(unsigned long first
    1.12  /* Initialise allocator to handle up to @max_page pages. */
    1.13  physaddr_t init_boot_allocator(physaddr_t bitmap_start)
    1.14  {
    1.15 +    unsigned long bitmap_size;
    1.16 +
    1.17      bitmap_start = round_pgup(bitmap_start);
    1.18  
    1.19 -    /* Allocate space for the allocation bitmap. */
    1.20 +    /*
    1.21 +     * Allocate space for the allocation bitmap. Include an extra longword
    1.22 +     * of padding for possible overrun in map_alloc and map_free.
    1.23 +     */
    1.24      bitmap_size  = max_page / 8;
    1.25 +    bitmap_size += sizeof(unsigned long);
    1.26      bitmap_size  = round_pgup(bitmap_size);
    1.27      alloc_bitmap = (unsigned long *)phys_to_virt(bitmap_start);
    1.28  
    1.29 @@ -171,7 +176,7 @@ void init_boot_pages(physaddr_t ps, phys
    1.30          else if ( *p != '\0' )
    1.31              break;
    1.32  
    1.33 -        if ( (bad_pfn < (bitmap_size*8)) && !allocated_in_map(bad_pfn) )
    1.34 +        if ( (bad_pfn < max_page) && !allocated_in_map(bad_pfn) )
    1.35          {
    1.36              printk("Marking page %lx as bad\n", bad_pfn);
    1.37              map_alloc(bad_pfn, 1);
    1.38 @@ -183,7 +188,7 @@ unsigned long alloc_boot_pages(unsigned 
    1.39  {
    1.40      unsigned long pg, i;
    1.41  
    1.42 -    for ( pg = 0; (pg + nr_pfns) < (bitmap_size*8); pg += pfn_align )
    1.43 +    for ( pg = 0; (pg + nr_pfns) < max_page; pg += pfn_align )
    1.44      {
    1.45          for ( i = 0; i < nr_pfns; i++ )
    1.46              if ( allocated_in_map(pg + i) )
    1.47 @@ -362,7 +367,7 @@ void scrub_heap_pages(void)
    1.48  
    1.49      printk("Scrubbing Free RAM: ");
    1.50  
    1.51 -    for ( pfn = 0; pfn < (bitmap_size * 8); pfn++ )
    1.52 +    for ( pfn = 0; pfn < max_page; pfn++ )
    1.53      {
    1.54          /* Every 100MB, print a progress dot. */
    1.55          if ( (pfn % ((100*1024*1024)/PAGE_SIZE)) == 0 )