ia64/linux-2.6.18-xen.hg

changeset 708:e410857fd83c

Remove contiguous_bitmap[] as it's no longer needed.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Oct 22 14:55:29 2008 +0100 (2008-10-22)
parents f7a2c0985f99
children 2b1dc4b1b231
files arch/i386/kernel/pci-dma-xen.c arch/i386/mm/hypervisor.c arch/i386/mm/init-xen.c arch/ia64/kernel/setup.c arch/ia64/xen/hypervisor.c arch/ia64/xen/xen_dma.c arch/x86_64/mm/init-xen.c include/asm-ia64/hypervisor.h
line diff
     1.1 --- a/arch/i386/kernel/pci-dma-xen.c	Wed Oct 22 11:54:44 2008 +0100
     1.2 +++ b/arch/i386/kernel/pci-dma-xen.c	Wed Oct 22 14:55:29 2008 +0100
     1.3 @@ -97,17 +97,11 @@ static int check_pages_physically_contig
     1.4  
     1.5  int range_straddles_page_boundary(paddr_t p, size_t size)
     1.6  {
     1.7 -	extern unsigned long *contiguous_bitmap;
     1.8  	unsigned long pfn = p >> PAGE_SHIFT;
     1.9  	unsigned int offset = p & ~PAGE_MASK;
    1.10  
    1.11 -	if (offset + size <= PAGE_SIZE)
    1.12 -		return 0;
    1.13 -	if (test_bit(pfn, contiguous_bitmap))
    1.14 -		return 0;
    1.15 -	if (check_pages_physically_contiguous(pfn, offset, size))
    1.16 -		return 0;
    1.17 -	return 1;
    1.18 +	return ((offset + size > PAGE_SIZE) &&
    1.19 +		!check_pages_physically_contiguous(pfn, offset, size));
    1.20  }
    1.21  
    1.22  int
     2.1 --- a/arch/i386/mm/hypervisor.c	Wed Oct 22 11:54:44 2008 +0100
     2.2 +++ b/arch/i386/mm/hypervisor.c	Wed Oct 22 14:55:29 2008 +0100
     2.3 @@ -190,54 +190,6 @@ void xen_set_ldt(const void *ptr, unsign
     2.4  	BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
     2.5  }
     2.6  
     2.7 -/*
     2.8 - * Bitmap is indexed by page number. If bit is set, the page is part of a
     2.9 - * xen_create_contiguous_region() area of memory.
    2.10 - */
    2.11 -unsigned long *contiguous_bitmap;
    2.12 -
    2.13 -static void contiguous_bitmap_set(
    2.14 -	unsigned long first_page, unsigned long nr_pages)
    2.15 -{
    2.16 -	unsigned long start_off, end_off, curr_idx, end_idx;
    2.17 -
    2.18 -	curr_idx  = first_page / BITS_PER_LONG;
    2.19 -	start_off = first_page & (BITS_PER_LONG-1);
    2.20 -	end_idx   = (first_page + nr_pages) / BITS_PER_LONG;
    2.21 -	end_off   = (first_page + nr_pages) & (BITS_PER_LONG-1);
    2.22 -
    2.23 -	if (curr_idx == end_idx) {
    2.24 -		contiguous_bitmap[curr_idx] |=
    2.25 -			((1UL<<end_off)-1) & -(1UL<<start_off);
    2.26 -	} else {
    2.27 -		contiguous_bitmap[curr_idx] |= -(1UL<<start_off);
    2.28 -		while ( ++curr_idx < end_idx )
    2.29 -			contiguous_bitmap[curr_idx] = ~0UL;
    2.30 -		contiguous_bitmap[curr_idx] |= (1UL<<end_off)-1;
    2.31 -	}
    2.32 -}
    2.33 -
    2.34 -static void contiguous_bitmap_clear(
    2.35 -	unsigned long first_page, unsigned long nr_pages)
    2.36 -{
    2.37 -	unsigned long start_off, end_off, curr_idx, end_idx;
    2.38 -
    2.39 -	curr_idx  = first_page / BITS_PER_LONG;
    2.40 -	start_off = first_page & (BITS_PER_LONG-1);
    2.41 -	end_idx   = (first_page + nr_pages) / BITS_PER_LONG;
    2.42 -	end_off   = (first_page + nr_pages) & (BITS_PER_LONG-1);
    2.43 -
    2.44 -	if (curr_idx == end_idx) {
    2.45 -		contiguous_bitmap[curr_idx] &=
    2.46 -			-(1UL<<end_off) | ((1UL<<start_off)-1);
    2.47 -	} else {
    2.48 -		contiguous_bitmap[curr_idx] &= (1UL<<start_off)-1;
    2.49 -		while ( ++curr_idx != end_idx )
    2.50 -			contiguous_bitmap[curr_idx] = 0;
    2.51 -		contiguous_bitmap[curr_idx] &= -(1UL<<end_off);
    2.52 -	}
    2.53 -}
    2.54 -
    2.55  /* Protected by balloon_lock. */
    2.56  #define MAX_CONTIG_ORDER 9 /* 2MB */
    2.57  static unsigned long discontig_frames[1<<MAX_CONTIG_ORDER];
    2.58 @@ -334,10 +286,6 @@ int xen_create_contiguous_region(
    2.59  	if (HYPERVISOR_multicall_check(cr_mcl, i, NULL))
    2.60  		BUG();
    2.61  
    2.62 -	if (success)
    2.63 -		contiguous_bitmap_set(__pa(vstart) >> PAGE_SHIFT,
    2.64 -				      1UL << order);
    2.65 -
    2.66  	balloon_unlock(flags);
    2.67  
    2.68  	return success ? 0 : -ENOMEM;
    2.69 @@ -363,8 +311,7 @@ void xen_destroy_contiguous_region(unsig
    2.70  		}
    2.71  	};
    2.72  
    2.73 -	if (xen_feature(XENFEAT_auto_translated_physmap) ||
    2.74 -	    !test_bit(__pa(vstart) >> PAGE_SHIFT, contiguous_bitmap))
    2.75 +	if (xen_feature(XENFEAT_auto_translated_physmap))
    2.76  		return;
    2.77  
    2.78  	if (unlikely(order > MAX_CONTIG_ORDER))
    2.79 @@ -377,8 +324,6 @@ void xen_destroy_contiguous_region(unsig
    2.80  
    2.81  	balloon_lock(flags);
    2.82  
    2.83 -	contiguous_bitmap_clear(__pa(vstart) >> PAGE_SHIFT, 1UL << order);
    2.84 -
    2.85  	/* 1. Find start MFN of contiguous extent. */
    2.86  	in_frame = pfn_to_mfn(__pa(vstart) >> PAGE_SHIFT);
    2.87  
     3.1 --- a/arch/i386/mm/init-xen.c	Wed Oct 22 11:54:44 2008 +0100
     3.2 +++ b/arch/i386/mm/init-xen.c	Wed Oct 22 14:55:29 2008 +0100
     3.3 @@ -47,8 +47,6 @@
     3.4  #include <asm/hypervisor.h>
     3.5  #include <asm/swiotlb.h>
     3.6  
     3.7 -extern unsigned long *contiguous_bitmap;
     3.8 -
     3.9  unsigned int __VMALLOC_RESERVE = 128 << 20;
    3.10  
    3.11  DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
    3.12 @@ -620,11 +618,6 @@ void __init mem_init(void)
    3.13  	int bad_ppro;
    3.14  	unsigned long pfn;
    3.15  
    3.16 -	contiguous_bitmap = alloc_bootmem_low_pages(
    3.17 -		(max_low_pfn + 2*BITS_PER_LONG) >> 3);
    3.18 -	BUG_ON(!contiguous_bitmap);
    3.19 -	memset(contiguous_bitmap, 0, (max_low_pfn + 2*BITS_PER_LONG) >> 3);
    3.20 -
    3.21  #if defined(CONFIG_SWIOTLB)
    3.22  	swiotlb_init();	
    3.23  #endif
     4.1 --- a/arch/ia64/kernel/setup.c	Wed Oct 22 11:54:44 2008 +0100
     4.2 +++ b/arch/ia64/kernel/setup.c	Wed Oct 22 14:55:29 2008 +0100
     4.3 @@ -684,9 +684,6 @@ setup_arch (char **cmdline_p)
     4.4  	}
     4.5  #endif
     4.6  	paging_init();
     4.7 -#ifdef CONFIG_XEN
     4.8 -	xen_contiguous_bitmap_init(max_pfn);
     4.9 -#endif
    4.10  }
    4.11  
    4.12  /*
     5.1 --- a/arch/ia64/xen/hypervisor.c	Wed Oct 22 11:54:44 2008 +0100
     5.2 +++ b/arch/ia64/xen/hypervisor.c	Wed Oct 22 14:55:29 2008 +0100
     5.3 @@ -80,154 +80,6 @@ xen_cpu_init(void)
     5.4  }
     5.5  
     5.6  /*
     5.7 - *XXX same as i386, x86_64 contiguous_bitmap_set(), contiguous_bitmap_clear()
     5.8 - * move those to lib/contiguous_bitmap?
     5.9 - *XXX discontigmem/sparsemem
    5.10 - */
    5.11 -
    5.12 -/*
    5.13 - * Bitmap is indexed by page number. If bit is set, the page is part of a
    5.14 - * xen_create_contiguous_region() area of memory.
    5.15 - */
    5.16 -unsigned long *contiguous_bitmap __read_mostly;
    5.17 -
    5.18 -#ifdef CONFIG_VIRTUAL_MEM_MAP
    5.19 -/* Following logic is stolen from create_mem_map_table() for virtual memmap */
    5.20 -static int
    5.21 -create_contiguous_bitmap(u64 start, u64 end, void *arg)
    5.22 -{
    5.23 -	unsigned long address, start_page, end_page;
    5.24 -	unsigned long bitmap_start, bitmap_end;
    5.25 -	unsigned char *bitmap;
    5.26 -	int node;
    5.27 -	pgd_t *pgd;
    5.28 -	pud_t *pud;
    5.29 -	pmd_t *pmd;
    5.30 -	pte_t *pte;
    5.31 -
    5.32 -	bitmap_start = (unsigned long)contiguous_bitmap +
    5.33 -		       ((__pa(start) >> PAGE_SHIFT) >> 3);
    5.34 -	bitmap_end = (unsigned long)contiguous_bitmap +
    5.35 -		     (((__pa(end) >> PAGE_SHIFT) + 2 * BITS_PER_LONG) >> 3);
    5.36 -
    5.37 -	start_page = bitmap_start & PAGE_MASK;
    5.38 -	end_page = PAGE_ALIGN(bitmap_end);
    5.39 -	node = paddr_to_nid(__pa(start));
    5.40 -
    5.41 -	bitmap = alloc_bootmem_pages_node(NODE_DATA(node),
    5.42 -					  end_page - start_page);
    5.43 -	BUG_ON(!bitmap);
    5.44 -	memset(bitmap, 0, end_page - start_page);
    5.45 -
    5.46 -	for (address = start_page; address < end_page; address += PAGE_SIZE) {
    5.47 -		pgd = pgd_offset_k(address);
    5.48 -		if (pgd_none(*pgd))
    5.49 -			pgd_populate(&init_mm, pgd,
    5.50 -				     alloc_bootmem_pages_node(NODE_DATA(node),
    5.51 -							      PAGE_SIZE));
    5.52 -		pud = pud_offset(pgd, address);
    5.53 -
    5.54 -		if (pud_none(*pud))
    5.55 -			pud_populate(&init_mm, pud,
    5.56 -				     alloc_bootmem_pages_node(NODE_DATA(node),
    5.57 -							      PAGE_SIZE));
    5.58 -		pmd = pmd_offset(pud, address);
    5.59 -
    5.60 -		if (pmd_none(*pmd))
    5.61 -			pmd_populate_kernel(&init_mm, pmd,
    5.62 -					    alloc_bootmem_pages_node
    5.63 -					    (NODE_DATA(node), PAGE_SIZE));
    5.64 -		pte = pte_offset_kernel(pmd, address);
    5.65 -
    5.66 -		if (pte_none(*pte))
    5.67 -			set_pte(pte,
    5.68 -				pfn_pte(__pa(bitmap + (address - start_page))
    5.69 -					>> PAGE_SHIFT, PAGE_KERNEL));
    5.70 -	}
    5.71 -	return 0;
    5.72 -}
    5.73 -#endif
    5.74 -
    5.75 -static void
    5.76 -__contiguous_bitmap_init(unsigned long size)
    5.77 -{
    5.78 -	contiguous_bitmap = alloc_bootmem_pages(size);
    5.79 -	BUG_ON(!contiguous_bitmap);
    5.80 -	memset(contiguous_bitmap, 0, size);
    5.81 -}
    5.82 -
    5.83 -void
    5.84 -xen_contiguous_bitmap_init(unsigned long end_pfn)
    5.85 -{
    5.86 -	unsigned long size = (end_pfn + 2 * BITS_PER_LONG) >> 3;
    5.87 -#ifndef CONFIG_VIRTUAL_MEM_MAP
    5.88 -	__contiguous_bitmap_init(size);
    5.89 -#else
    5.90 -	unsigned long max_gap = 0;
    5.91 -
    5.92 -	efi_memmap_walk(find_largest_hole, (u64*)&max_gap);
    5.93 -	if (max_gap < LARGE_GAP) {
    5.94 -		__contiguous_bitmap_init(size);
    5.95 -	} else {
    5.96 -		unsigned long map_size = PAGE_ALIGN(size);
    5.97 -		vmalloc_end -= map_size;
    5.98 -		contiguous_bitmap = (unsigned long*)vmalloc_end;
    5.99 -		efi_memmap_walk(create_contiguous_bitmap, NULL);
   5.100 -	}
   5.101 -#endif
   5.102 -}
   5.103 -
   5.104 -#if 0
   5.105 -int
   5.106 -contiguous_bitmap_test(void* p)
   5.107 -{
   5.108 -	return test_bit(__pa(p) >> PAGE_SHIFT, contiguous_bitmap);
   5.109 -}
   5.110 -#endif
   5.111 -
   5.112 -static void contiguous_bitmap_set(
   5.113 -	unsigned long first_page, unsigned long nr_pages)
   5.114 -{
   5.115 -	unsigned long start_off, end_off, curr_idx, end_idx;
   5.116 -
   5.117 -	curr_idx  = first_page / BITS_PER_LONG;
   5.118 -	start_off = first_page & (BITS_PER_LONG-1);
   5.119 -	end_idx   = (first_page + nr_pages) / BITS_PER_LONG;
   5.120 -	end_off   = (first_page + nr_pages) & (BITS_PER_LONG-1);
   5.121 -
   5.122 -	if (curr_idx == end_idx) {
   5.123 -		contiguous_bitmap[curr_idx] |=
   5.124 -			((1UL<<end_off)-1) & -(1UL<<start_off);
   5.125 -	} else {
   5.126 -		contiguous_bitmap[curr_idx] |= -(1UL<<start_off);
   5.127 -		while ( ++curr_idx < end_idx )
   5.128 -			contiguous_bitmap[curr_idx] = ~0UL;
   5.129 -		contiguous_bitmap[curr_idx] |= (1UL<<end_off)-1;
   5.130 -	}
   5.131 -}
   5.132 -
   5.133 -static void contiguous_bitmap_clear(
   5.134 -	unsigned long first_page, unsigned long nr_pages)
   5.135 -{
   5.136 -	unsigned long start_off, end_off, curr_idx, end_idx;
   5.137 -
   5.138 -	curr_idx  = first_page / BITS_PER_LONG;
   5.139 -	start_off = first_page & (BITS_PER_LONG-1);
   5.140 -	end_idx   = (first_page + nr_pages) / BITS_PER_LONG;
   5.141 -	end_off   = (first_page + nr_pages) & (BITS_PER_LONG-1);
   5.142 -
   5.143 -	if (curr_idx == end_idx) {
   5.144 -		contiguous_bitmap[curr_idx] &=
   5.145 -			-(1UL<<end_off) | ((1UL<<start_off)-1);
   5.146 -	} else {
   5.147 -		contiguous_bitmap[curr_idx] &= (1UL<<start_off)-1;
   5.148 -		while ( ++curr_idx != end_idx )
   5.149 -			contiguous_bitmap[curr_idx] = 0;
   5.150 -		contiguous_bitmap[curr_idx] &= -(1UL<<end_off);
   5.151 -	}
   5.152 -}
   5.153 -
   5.154 -/*
   5.155   * __xen_create_contiguous_region(), __xen_destroy_contiguous_region()
   5.156   * are based on i386 xen_create_contiguous_region(),
   5.157   * xen_destroy_contiguous_region()
   5.158 @@ -303,8 +155,6 @@ int
   5.159  		} else
   5.160  			success = 1;
   5.161  	}
   5.162 -	if (success)
   5.163 -		contiguous_bitmap_set(start_gpfn, num_gpfn);
   5.164  #if 0
   5.165  	if (success) {
   5.166  		unsigned long mfn;
   5.167 @@ -363,9 +213,6 @@ void
   5.168  	};
   5.169  	
   5.170  
   5.171 -	if (!test_bit(start_gpfn, contiguous_bitmap))
   5.172 -		return;
   5.173 -
   5.174  	if (unlikely(order > MAX_CONTIG_ORDER))
   5.175  		return;
   5.176  
   5.177 @@ -376,8 +223,6 @@ void
   5.178  
   5.179  	balloon_lock(flags);
   5.180  
   5.181 -	contiguous_bitmap_clear(start_gpfn, num_gpfn);
   5.182 -
   5.183  	/* Do the exchange for non-contiguous MFNs. */
   5.184  	in_frame = start_gpfn;
   5.185  	for (i = 0; i < num_gpfn; i++)
     6.1 --- a/arch/ia64/xen/xen_dma.c	Wed Oct 22 11:54:44 2008 +0100
     6.2 +++ b/arch/ia64/xen/xen_dma.c	Wed Oct 22 14:55:29 2008 +0100
     6.3 @@ -57,7 +57,6 @@ static int check_pages_physically_contig
     6.4  
     6.5  int range_straddles_page_boundary(paddr_t p, size_t size)
     6.6  {
     6.7 -	extern unsigned long *contiguous_bitmap;
     6.8  	unsigned long pfn = p >> PAGE_SHIFT;
     6.9  	unsigned int offset = p & ~PAGE_MASK;
    6.10  
    6.11 @@ -66,8 +65,6 @@ int range_straddles_page_boundary(paddr_
    6.12  
    6.13  	if (offset + size <= PAGE_SIZE)
    6.14  		return 0;
    6.15 -	if (test_bit(pfn, contiguous_bitmap))
    6.16 -		return 0;
    6.17  	if (check_pages_physically_contiguous(pfn, offset, size))
    6.18  		return 0;
    6.19  	return 1;
     7.1 --- a/arch/x86_64/mm/init-xen.c	Wed Oct 22 11:54:44 2008 +0100
     7.2 +++ b/arch/x86_64/mm/init-xen.c	Wed Oct 22 14:55:29 2008 +0100
     7.3 @@ -61,8 +61,6 @@ EXPORT_SYMBOL(__kernel_page_user);
     7.4  
     7.5  int after_bootmem;
     7.6  
     7.7 -extern unsigned long *contiguous_bitmap;
     7.8 -
     7.9  static unsigned long dma_reserve __initdata;
    7.10  
    7.11  DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
    7.12 @@ -972,11 +970,6 @@ void __init mem_init(void)
    7.13  	long codesize, reservedpages, datasize, initsize;
    7.14  	unsigned long pfn;
    7.15  
    7.16 -	contiguous_bitmap = alloc_bootmem_low_pages(
    7.17 -		(end_pfn + 2*BITS_PER_LONG) >> 3);
    7.18 -	BUG_ON(!contiguous_bitmap);
    7.19 -	memset(contiguous_bitmap, 0, (end_pfn + 2*BITS_PER_LONG) >> 3);
    7.20 -
    7.21  	pci_iommu_alloc();
    7.22  
    7.23  	/* How many end-of-memory variables you have, grandma! */
     8.1 --- a/include/asm-ia64/hypervisor.h	Wed Oct 22 11:54:44 2008 +0100
     8.2 +++ b/include/asm-ia64/hypervisor.h	Wed Oct 22 14:55:29 2008 +0100
     8.3 @@ -140,7 +140,6 @@ int privcmd_mmap(struct file * file, str
     8.4  #define	pte_mfn(_x)	pte_pfn(_x)
     8.5  #define phys_to_machine_mapping_valid(_x)	(1)
     8.6  
     8.7 -void xen_contiguous_bitmap_init(unsigned long end_pfn);
     8.8  int __xen_create_contiguous_region(unsigned long vstart, unsigned int order, unsigned int address_bits);
     8.9  static inline int
    8.10  xen_create_contiguous_region(unsigned long vstart,